Examples of AggregatingNotifyingFutureImpl


Examples of org.infinispan.commons.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.invokeRemotelyInFuture(null, ic, rpcManager.getDefaultRpcOptions(true), future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.invokeRemotely(null, ic, rpcManager.getDefaultRpcOptions(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, syncIgnoreLeaversRpcOptions, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.commons.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.invokeRemotelyInFuture(null, ic, rpcManager.getDefaultRpcOptions(true), future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.invokeRemotely(null, ic, rpcManager.getDefaultRpcOptions(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, syncIgnoreLeaversRpcOptions, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.commons.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.invokeRemotelyInFuture(null, ic, rpcManager.getDefaultRpcOptions(true), future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.invokeRemotely(null, ic, rpcManager.getDefaultRpcOptions(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, syncIgnoreLeaversRpcOptions, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
View Full Code Here

Examples of org.infinispan.commons.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.invokeRemotelyInFuture(null, ic, rpcManager.getDefaultRpcOptions(true), future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
                  public Object call() throws Exception {
                     rpcManager.invokeRemotely(null, ic, rpcManager.getDefaultRpcOptions(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, syncIgnoreLeaversRpcOptions, future);
               return future;
            } else {
               return asyncTransportExecutor.submit(new Callable<Object>() {
                  @Override
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

   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();
         log.debugf("%s pushing to %s %d keys", self, target, state.size());
         if (trace) log.tracef("Pushed 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, 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

   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

         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
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.