Examples of AggregatingNotifyingFutureImpl


Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, Object[] keys, boolean useFuture, Object retval, boolean sync) {
      if (isL1CacheEnabled && numCallRecipients > 0 && rpcManager.getTransport().getMembers().size() > numCallRecipients) {
         if (trace) log.trace("Invalidating L1 caches");
         InvalidateCommand ic = cf.buildInvalidateFromL1Command(keys);
         if (useFuture) {
            NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
            rpcManager.broadcastRpcCommandInFuture(ic, future);
            return future;
         } else {
            rpcManager.broadcastRpcCommand(ic, sync);
         }
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

   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, Collection<Object> keys, Object retval) {
      if (isL1CacheEnabled && 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;
      } else {
         if (trace) log.trace("Not performing invalidation! isL1CacheEnabled? {0} numCallRecipients={1}", isL1CacheEnabled, numCallRecipients);
      }
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

         throw e;
      }
   }

   private void pushState(ConsistentHash chOld, ConsistentHash chNew, Map<Address, Map<Object, InternalCacheValue>> states) throws InterruptedException, ExecutionException {
      NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, states.size());

      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());
      }

      // wait to see if all servers received the new state
      // TODO we might want to retry the state transfer operation if it failed on some of the nodes and the view hasn't changed
      try {
         stateTransferFuture.get();
      } catch (ExecutionException e) {
         log.errorTransferringState(e);
         throw e;
      }
      log.debugf("Node finished pushing data for rehash %d", newViewId);
View Full Code Here

Examples of org.infinispan.util.concurrent.AggregatingNotifyingFutureImpl

   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, 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

   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

   protected abstract void commitStateTransfer();

   protected void pushState(Map<Address, Collection<InternalCacheEntry>> states)
         throws InterruptedException, ExecutionException, PendingStateTransferException, TimeoutException {
      NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, states.size());
      for (Map.Entry<Address, Collection<InternalCacheEntry>> entry : states.entrySet()) {
         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 rehash %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.trace("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

         throw e;
      }
   }

   private void pushState(ConsistentHash chOld, ConsistentHash chNew, Map<Address, Map<Object, InternalCacheValue>> states) throws InterruptedException, ExecutionException {
      NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, states.size());
      for (Map.Entry<Address, Map<Object, InternalCacheValue>> entry : states.entrySet()) {
         final Address target = entry.getKey();
         Map<Object, InternalCacheValue> state = entry.getValue();
         log.debugf("Pushing to node %s %d keys", target, state.size());
         log.tracef("Pushing to node %s keys: %s", 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());
      }

      // wait to see if all servers received the new state
      // TODO we might want to retry the state transfer operation if it failed on some of the nodes and the view hasn't changed
      try {
         stateTransferFuture.get();
      } catch (ExecutionException e) {
         log.errorTransferringState(e);
         throw e;
      }
      log.debugf("Node finished pushing data for rehash %d.", newViewId);
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> removedKeys = new ArrayList<Object>();
            NotifyingNotifiableFuture<Object> stateTransferFuture = new AggregatingNotifyingFutureImpl(null, newMembers.size());

            try {
               // Don't need to log anything, all transactions will be blocked
               //distributionManager.getTransactionLogger().enable();
               distributionManager.getTransactionLogger().blockNewTransactions();

               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, removedKeys);
               }

               // 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, removedKeys);
                  }
               } 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("pushing %d keys to %s", state.size(), target);

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

                  rpcManager.invokeRemotelyInFuture(Collections.singleton(target), cmd,
                                                    false, stateTransferFuture, configuration.getRehashRpcTimeout());
               }
            } finally {
               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.error("Error transferring state to node after rehash:", e);
            }

            // Notify listeners of completion of rehashing
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.