Examples of AggregatingNotifyingFutureImpl


Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   }
  
   public NotifyingNotifiableFuture<Object> flushCache(Collection<Object> keys, Object retval, Address origin) {
      if (trace) log.tracef("Invalidating L1 caches for keys %s", keys);
     
      NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
     
      Collection<Address> invalidationAddresses = buildInvalidationAddressList(keys, origin);
     
      int nodes = invalidationAddresses.size();
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

         if (multicast) {
            if (trace) log.tracef("Invalidating keys %s via multicast", keys);
            final InvalidateCommand ic = commandsFactory.buildInvalidateFromL1Command(origin, false, keys);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.broadcastRpcCommandInFuture(ic, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.broadcastRpcCommand(ic, true);
                     return retval;
                  }
               });
            }
         } else {
            final CacheRpcCommand rpc = commandsFactory.buildSingleRpcCommand(commandsFactory.buildInvalidateFromL1Command(origin, false, keys));
            // Ask the caches who have requested from us to remove
            if (trace) log.tracef("Keys %s needs invalidation on %s", keys, invalidationAddresses);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.invokeRemotelyInFuture(invalidationAddresses, rpc, true, future, rpcTimeout, true);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

         if (multicast) {
            if (trace) log.tracef("Invalidating keys %s via multicast", keys);
            final InvalidateCommand ic = commandsFactory.buildInvalidateFromL1Command(origin, false, Collections.<Flag>emptySet(), keys);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.broadcastRpcCommandInFuture(ic, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.broadcastRpcCommand(ic, true);
                     return retval;
                  }
               });
            }
         } else {
            final CacheRpcCommand rpc = commandsFactory.buildSingleRpcCommand(
                  commandsFactory.buildInvalidateFromL1Command(origin, false, Collections.<Flag>emptySet(), keys));
            // Ask the caches who have requested from us to remove
            if (trace) log.tracef("Keys %s needs invalidation on %s", keys, invalidationAddresses);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.invokeRemotelyInFuture(invalidationAddresses, rpc, true, future, rpcTimeout, true);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

         if (multicast) {
            if (trace) log.tracef("Invalidating keys %s via multicast", keys);
            final InvalidateCommand ic = commandsFactory.buildInvalidateFromL1Command(origin, false, keys);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.broadcastRpcCommandInFuture(ic, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.broadcastRpcCommand(ic, true);
                     return retval;
                  }
               });
            }
         } else {
            final CacheRpcCommand rpc = commandsFactory.buildSingleRpcCommand(commandsFactory.buildInvalidateFromL1Command(origin, false, keys));
            // Ask the caches who have requested from us to remove
            if (trace) log.tracef("Keys %s needs invalidation on %s", keys, invalidationAddresses);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.invokeRemotelyInFuture(invalidationAddresses, rpc, true, future, rpcTimeout, true);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, Collection<Object> keys, Object retval) {
      if (isL1CacheEnabled && numCallRecipients > 0 && rpcManager.getTransport().getMembers().size() > numCallRecipients) {
         if (trace) log.trace("Invalidating L1 caches");
         InvalidateCommand ic = cf.buildInvalidateFromL1Command(false, keys);
         NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
         rpcManager.broadcastRpcCommandInFuture(ic, future);
         return future;
      }
      return null;
   }
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

               // notify listeners that a rehash is about to start
               notifier.notifyDataRehashed(oldCacheSet, newCacheSet, newViewId, true);

               List<Object> keysToRemove = new ArrayList<Object>();
               NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, newMembers.size());

               int numOwners = configuration.getNumOwners();

               // Contains the state to be pushed to various servers. The state is a hashmap of keys and values
               final Map<Address, Map<Object, InternalCacheValue>> states = new HashMap<Address, Map<Object, InternalCacheValue>>();

               for (InternalCacheEntry ice : dataContainer) {
                  rebalance(ice.getKey(), ice, numOwners, chOld, chNew, null, states, keysToRemove);
               }

               // Only fetch the data from the cache store if the cache store is not shared
               CacheStore cacheStore = distributionManager.getCacheStoreForRehashing();
               if (cacheStore != null) {
                  for (Object key : cacheStore.loadAllKeys(new ReadOnlyDataContainerBackedKeySet(dataContainer))) {
                     rebalance(key, null, numOwners, chOld, chNew, cacheStore, states, keysToRemove);
                  }
               } else {
                  if (trace) log.trace("Shared cache store or fetching of persistent state disabled");
               }

               // Now for each server S in states.keys(): push states.get(S) to S via RPC
               for (Map.Entry<Address, Map<Object, InternalCacheValue>> entry : states.entrySet()) {
                  final Address target = entry.getKey();
                  Map<Object, InternalCacheValue> state = entry.getValue();
                  if (trace)
                     log.tracef("%s pushing to %s keys %s", self, target, state.keySet());

                  final RehashControlCommand cmd = cf.buildRehashControlCommand(RehashControlCommand.Type.APPLY_STATE, self,
                        newViewId, state, chOld, chNew);

                  rpcManager.invokeRemotelyInFuture(Collections.singleton(target), cmd,
                                                    false, stateTransferFuture, configuration.getRehashRpcTimeout());
               }

               // TODO Allow APPLY_STATE RehashControlCommand to skip transaction blocking, so we can unblock new transactions
               // only after we have invalidated the keys removed from this cache
               // For transactions TransactionTable should have already rolled back the transactions touching those keys,
               // but it still might be a problem for non-transactional writes.
               needToUnblockTransactions = false;
               distributionManager.getTransactionLogger().unblockNewTransactions();

               // wait to see if all servers received the new state
               // TODO should we retry the state transfer operation if it failed on some of the nodes?
               try {
                  stateTransferFuture.get();
               } catch (ExecutionException e) {
                  log.errorTransferringState(e);
               }

               // Notify listeners of completion of rehashing
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   }
  
   public NotifyingNotifiableFuture<Object> flushCache(Collection<Object> keys, Object retval, Address origin) {
      if (trace) log.tracef("Invalidating L1 caches for keys %s", keys);
     
      NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
     
      Collection<Address> invalidationAddresses = buildInvalidationAddressList(keys, origin);
     
      int nodes = invalidationAddresses.size();
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

         if (multicast) {
            if (trace) log.tracef("Invalidating keys %s via multicast", keys);
            final InvalidateCommand ic = commandsFactory.buildInvalidateFromL1Command(
                  origin, false, InfinispanCollections.<Flag>emptySet(), keys);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.broadcastRpcCommandInFuture(ic, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.broadcastRpcCommand(ic, true);
                     return retval;
                  }
               });
            }
         } else {
            final CacheRpcCommand rpc = commandsFactory.buildSingleRpcCommand(
                  commandsFactory.buildInvalidateFromL1Command(origin, false,
                        InfinispanCollections.<Flag>emptySet(), keys));
            // Ask the caches who have requested from us to remove
            if (trace) log.tracef("Keys %s needs invalidation on %s", keys, invalidationAddresses);
            if (useNotifyingFuture) {
               NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
               rpcManager.invokeRemotelyInFuture(invalidationAddresses, rpc, true, future, rpcTimeout, true);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   }


   protected void pushState(Map<Address, Collection<InternalCacheEntry>> states)
         throws InterruptedException, ExecutionException, StateTransferCancelledException, TimeoutException {
      NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, states.size());
      for (Map.Entry<Address, Collection<InternalCacheEntry>> entry : states.entrySet()) {
         checkIfCancelled();
         final Address target = entry.getKey();
         Collection<InternalCacheEntry> state = entry.getValue();
         stateTransferManager.pushStateToNode(stateTransferFuture, newViewId, target, state);
      }

      // wait to see if all servers received the new state
      stateTransferFuture.get(configuration.getRehashRpcTimeout(), TimeUnit.MILLISECONDS);
      log.debugf("Node finished pushing data for cache views %d.", newViewId);
   }
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   }
  
   public NotifyingNotifiableFuture<Object> flushCache(Collection<Object> keys, Object retval, Address origin) {
      if (trace) log.tracef("Invalidating L1 caches for keys %s", keys);
     
      NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
     
      Collection<Address> invalidationAddresses = buildInvalidationAddressList(keys, origin);
     
      int nodes = invalidationAddresses.size();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.