예제 #1
0
 @Override
 public void run() {
   try {
     invoke();
   } catch (Throwable e) {
     clientInvocationFuture.complete(e);
   }
 }
예제 #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);
  }
예제 #3
0
 @Override
 public void run() {
   try {
     invoke();
   } catch (Throwable e) {
     if (handler != null) {
       listenerService.registerFailedListener(this);
     } else {
       clientInvocationFuture.setResponse(e);
     }
   }
 }
예제 #4
0
  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);
  }
예제 #5
0
  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;
  }
예제 #6
0
 public ClientConnection getSendConnectionOrWait() throws InterruptedException {
   while (sendConnection == null && !clientInvocationFuture.isDone()) {
     Thread.sleep(TimeUnit.SECONDS.toMillis(RETRY_WAIT_TIME_IN_SECONDS));
   }
   return sendConnection;
 }
예제 #7
0
 public void notify(ClientMessage clientMessage) {
   if (clientMessage == null) {
     throw new IllegalArgumentException("response can't be null");
   }
   clientInvocationFuture.complete(clientMessage);
 }