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
 @Override
 public void checkIfLoaded() {
   if (isLoaded()) {
     try {
       // check all loading futures for exceptions
       FutureUtil.checkAllDone(loadingFutures);
     } catch (Exception e) {
       logger.severe("Exception while loading map " + name, e);
       ExceptionUtil.rethrow(e);
     } finally {
       loadingFutures.clear();
     }
   } else {
     keyLoader.triggerLoadingWithDelay();
     throw new RetryableHazelcastException(
         "Map " + getName() + " is still loading data from external store");
   }
 }
示例#3
0
  public void waitUntilLoaded() {
    try {
      int mapNamePartition = partitionService.getPartitionId(name);
      Operation op = new PartitionCheckIfLoadedOperation(name, false, true);
      Future loadingFuture = operationService.invokeOnPartition(SERVICE_NAME, op, mapNamePartition);
      // wait for keys to be loaded - it's insignificant since it doesn't trigger the keys loading
      // it's just waiting for them to be loaded. Timeout failure doesn't mean anything negative
      // here.
      // This call just introduces some ordering of requests.
      FutureUtil.waitWithDeadline(
          singleton(loadingFuture),
          CHECK_IF_LOADED_TIMEOUT_SECONDS,
          SECONDS,
          logAllExceptions(WARNING));

      OperationFactory opFactory = new PartitionCheckIfLoadedOperationFactory(name);
      Map<Integer, Object> results =
          operationService.invokeOnAllPartitions(SERVICE_NAME, opFactory);
      // wait for all the data to be loaded on all partitions - wait forever
      waitAllTrue(results, opFactory);
    } catch (Throwable t) {
      throw rethrow(t);
    }
  }
示例#4
0
 @Override
 public boolean isLoaded() {
   return FutureUtil.allDone(loadingFutures);
 }