Example #1
0
 @Override
 public void run() {
   try {
     invoke();
   } catch (Throwable e) {
     clientInvocationFuture.complete(e);
   }
 }
Example #2
0
  public void notifyException(Throwable exception) {
    if (!lifecycleService.isRunning()) {
      clientInvocationFuture.complete(
          new HazelcastClientNotActiveException(exception.getMessage(), exception));
      return;
    }

    if (isRetryable(exception)) {
      if (handleRetry()) {
        return;
      }
    }
    if (exception instanceof RetryableHazelcastException) {
      if (clientMessage.isRetryable() || invocationService.isRedoOperation()) {
        if (handleRetry()) {
          return;
        }
      }
    }
    clientInvocationFuture.complete(exception);
  }
 @Override
 public void run() {
   try {
     invoke();
   } catch (Throwable e) {
     if (handler != null) {
       listenerService.registerFailedListener(this);
     } else {
       clientInvocationFuture.setResponse(e);
     }
   }
 }
  public void notifyException(Throwable exception) {

    if (!lifecycleService.isRunning()) {
      clientInvocationFuture.setResponse(
          new HazelcastClientNotActiveException(exception.getMessage()));
      return;
    }

    if (exception instanceof IOException
        || exception instanceof HazelcastInstanceNotActiveException
        || exception instanceof AuthenticationException) {
      if (handleRetry()) {
        return;
      }
    }
    if (exception instanceof RetryableHazelcastException) {
      if (clientMessage.isRetryable() || invocationService.isRedoOperation()) {
        if (handleRetry()) {
          return;
        }
      }
    }
    clientInvocationFuture.setResponse(exception);
  }
  private boolean handleRetry() {

    if (isBindToSingleConnection()) {
      return false;
    }
    if (handler == null && reSendCount.incrementAndGet() > retryCountLimit) {
      return false;
    }
    if (handler != null) {
      handler.beforeListenerRegister();
    }

    try {
      sleep();
      executionService.execute(this);
    } catch (RejectedExecutionException e) {
      if (LOGGER.isFinestEnabled()) {
        LOGGER.finest("Retry could not be scheduled ", e);
      }
      clientInvocationFuture.setResponse(e);
    }
    return true;
  }
Example #6
0
 public ClientConnection getSendConnectionOrWait() throws InterruptedException {
   while (sendConnection == null && !clientInvocationFuture.isDone()) {
     Thread.sleep(TimeUnit.SECONDS.toMillis(RETRY_WAIT_TIME_IN_SECONDS));
   }
   return sendConnection;
 }
Example #7
0
 public void notify(ClientMessage clientMessage) {
   if (clientMessage == null) {
     throw new IllegalArgumentException("response can't be null");
   }
   clientInvocationFuture.complete(clientMessage);
 }