Exemple #1
0
    def _handle_exception(self, invocation, error, traceback=None):
        if not self._client.lifecycle.is_live:
            invocation.set_exception(HazelcastClientNotActiveException(error.args[0]), traceback)
            return
        if self.logger.isEnabledFor(logging.DEBUG):
            self.logger.debug("Got exception for request %s: %s: %s", invocation.request, type(error).__name__, error)
        if isinstance(error, (AuthenticationError, IOError, HazelcastInstanceNotActiveError)):
            if self._try_retry(invocation):
                return

        if is_retryable_error(error):
            if invocation.request.is_retryable() or self._is_redo_operation:
                if self._try_retry(invocation):
                    return

        invocation.set_exception(error, traceback)
Exemple #2
0
    def _handle_exception(self, invocation, error, traceback=None):
        if self.logger.isEnabledFor(logging.DEBUG):
            self.logger.debug("Got exception for request %s: %s: %s",
                              invocation.request,
                              type(error).__name__,
                              error,
                              extra=self._logger_extras)

        if not self._client.lifecycle.is_live:
            invocation.set_exception(
                HazelcastClientNotActiveException(error.args[0]), traceback)
            return

        if self._is_not_allowed_to_retry_on_selection(invocation, error):
            invocation.set_exception(error, traceback)
            return

        if not self._should_retry(invocation, error):
            invocation.set_exception(error, traceback)
            return

        if invocation.timeout < time.time():
            if self.logger.isEnabledFor(logging.DEBUG):
                self.logger.debug(
                    'Error will not be retried because invocation timed out: %s',
                    error,
                    extra=self._logger_extras)
            invocation.set_exception(
                TimeoutError(
                    '%s timed out because an error occurred after invocation timeout: %s'
                    % (invocation.request, error), traceback))
            return

        invoke_func = functools.partial(self.invoke, invocation)
        self._client.reactor.add_timer(self.invocation_retry_pause,
                                       invoke_func)