コード例 #1
0
 private void enableStatisticManagementOnNodes(
     String cacheName, boolean statOrMan, boolean enabled) {
   if (isClosed()) {
     throw new IllegalStateException();
   }
   if (cacheName == null) {
     throw new NullPointerException();
   }
   final ClientInvocationService invocationService = clientContext.getInvocationService();
   final Collection<MemberImpl> members = clientContext.getClusterService().getMemberList();
   final Collection<Future> futures = new ArrayList<Future>();
   for (MemberImpl member : members) {
     try {
       CacheManagementConfigRequest request =
           new CacheManagementConfigRequest(
               getCacheNameWithPrefix(cacheName), statOrMan, enabled, member.getAddress());
       final Future future = invocationService.invokeOnTarget(request, member.getAddress());
       futures.add(future);
     } catch (Exception e) {
       ExceptionUtil.sneakyThrow(e);
     }
   }
   // make sure all configs are created
   try {
     FutureUtil.waitWithDeadline(
         futures, CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
   } catch (TimeoutException e) {
     logger.warning(e);
   }
 }
コード例 #2
0
 private void invokeOnSelection() throws IOException {
   if (isBindToSingleConnection()) {
     invocationService.invokeOnConnection(this, (ClientConnection) connection);
   } else if (partitionId != -1) {
     invocationService.invokeOnPartitionOwner(this, partitionId);
   } else if (address != null) {
     invocationService.invokeOnTarget(this, address);
   } else {
     invocationService.invokeOnRandomTarget(this);
   }
 }
コード例 #3
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);
  }
コード例 #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);
  }