public void close(Throwable t) {
    if (!live.compareAndSet(true, false)) {
      return;
    }
    String message =
        "Connection ["
            + socketChannelWrapper.socket().getRemoteSocketAddress()
            + "] lost. Reason: ";
    if (t != null) {
      message += t.getClass().getName() + "[" + t.getMessage() + "]";
    } else {
      message += "Socket explicitly closed";
    }

    try {
      innerClose();
    } catch (Exception e) {
      logger.warning(e);
    }

    if (lifecycleService.isRunning()) {
      logger.warning(message);
    } else {
      logger.finest(message);
    }
  }
Esempio n. 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);
  }
  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);
  }