예제 #1
0
 @Override
 public CompletableFuture<Object> invokeAsync() throws Throwable {
   GlobalComponentRegistry globalComponentRegistry = cacheManager.getGlobalComponentRegistry();
   ComponentRegistry cacheComponentRegistry =
       globalComponentRegistry.getNamedComponentRegistry(cacheName);
   String name = cacheName.toString();
   if (cacheComponentRegistry != null) {
     cacheComponentRegistry.getComponent(PersistenceManager.class).setClearOnStop(true);
     cacheComponentRegistry.getComponent(CacheJmxRegistration.class).setUnregisterCacheMBean(true);
     cacheComponentRegistry.getComponent(PassivationManager.class).skipPassivationOnStop(true);
     Cache<?, ?> cache = cacheManager.getCache(name, false);
     if (cache != null) {
       cache.stop();
     }
   }
   globalComponentRegistry.removeCache(name);
   // Remove cache configuration and remove it from the computed cache name list
   globalComponentRegistry.getComponent(ConfigurationManager.class).removeConfiguration(name);
   // Remove cache from dependency graph
   //noinspection unchecked
   globalComponentRegistry
       .getComponent(DependencyGraph.class, CACHE_DEPENDENCY_GRAPH)
       .remove(cacheName);
   return CompletableFutures.completedNull();
 }
예제 #2
0
  @Override
  public CompletableFuture<Void> transactionDataFuture(int expectedTopologyId) {
    if (transactionDataTopologyId >= expectedTopologyId) return CompletableFutures.completedNull();

    if (trace) {
      log.tracef(
          "Waiting for transaction data for topology %d, current topology is %d",
          expectedTopologyId, transactionDataTopologyId);
    }
    synchronized (this) {
      if (transactionDataTopologyId >= expectedTopologyId) {
        return CompletableFutures.completedNull();
      } else {
        return transactionDataFuture.thenCompose(nil -> transactionDataFuture(expectedTopologyId));
      }
    }
  }