Examples of RPCManager


Examples of org.infinispan.remoting.RpcManager

      return globalConfiguration.getClusterName();
   }

   public List<Address> getMembers() {
      if (globalComponentRegistry == null) return null;
      RpcManager rpcManager = globalComponentRegistry.getComponent(RpcManager.class);
      return rpcManager == null ? null : rpcManager.getTransport().getMembers();
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

            Flag.FAIL_SILENTLY,
            Flag.ZERO_LOCK_ACQUISITION_TIMEOUT);
   }

   public static void broadcastEvictAll(AdvancedCache cache) {
      RpcManager rpcManager = cache.getRpcManager();
      if (rpcManager != null) {
         // Only broadcast evict all if it's clustered
         CacheCommandInitializer factory = cache.getComponentRegistry()
               .getComponent(CacheCommandInitializer.class);
         boolean isSync = isSynchronousCache(cache);

         EvictAllCommand cmd = factory.buildEvictAllCommand(cache.getName());
         rpcManager.broadcastRpcCommand(cmd, isSync);
      }
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      ExecutorService pooledExecutorService = new ThreadPoolExecutor(10, 20, 0L, TimeUnit.MILLISECONDS,
            new LinkedBlockingDeque<Runnable>(), threadFactory, new ThreadPoolExecutor.CallerRunsPolicy());

      StateTransferManager stateTransferManager = mock(StateTransferManager.class);
      CacheNotifier cacheNotifier = mock(CacheNotifier.class);
      RpcManager rpcManager = mock(RpcManager.class);
      Transport transport = mock(Transport.class);
      CommandsFactory commandsFactory = mock(CommandsFactory.class);
      CacheLoaderManager cacheLoaderManager = mock(CacheLoaderManager.class);
      DataContainer dataContainer = mock(DataContainer.class);
      TransactionTable transactionTable = mock(TransactionTable.class);
      StateTransferLock stateTransferLock = mock(StateTransferLock.class);
      InterceptorChain interceptorChain = mock(InterceptorChain.class);
      InvocationContextContainer icc = mock(InvocationContextContainer.class);

      when(commandsFactory.buildStateRequestCommand(any(StateRequestCommand.Type.class), any(Address.class), anyInt(), any(Set.class))).thenAnswer(new Answer<StateRequestCommand>() {
         @Override
         public StateRequestCommand answer(InvocationOnMock invocation) {
            return new StateRequestCommand("cache1", (StateRequestCommand.Type) invocation.getArguments()[0], (Address) invocation.getArguments()[1], (Integer) invocation.getArguments()[2], (Set) invocation.getArguments()[3]);
         }
      });

      when(transport.getViewId()).thenReturn(1);
      when(rpcManager.getAddress()).thenReturn(addresses[0]);
      when(rpcManager.getTransport()).thenReturn(transport);

      final Map<Address, Set<Integer>> requestedSegments = ConcurrentMapFactory.makeConcurrentMap();
      final Set<Integer> flatRequestedSegments = new ConcurrentSkipListSet<Integer>();
      when(rpcManager.invokeRemotely(any(Collection.class), any(StateRequestCommand.class), any(ResponseMode.class), anyLong())).thenAnswer(new Answer<Map<Address, Response>>() {
         @Override
         public Map<Address, Response> answer(InvocationOnMock invocation) {
            Collection<Address> recipients = (Collection<Address>) invocation.getArguments()[0];
            Address recipient = recipients.iterator().next();
            StateRequestCommand cmd = (StateRequestCommand) invocation.getArguments()[1];
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      assertEquals(op.getValue(), cache0.get(key));
      assertEquals(op.getValue(), cache1.get(key));
   }

   private ControlledRpcManager blockStateResponseCommand(final Cache cache) throws InterruptedException {
      RpcManager rpcManager = TestingUtil.extractComponent(cache, RpcManager.class);
      ControlledRpcManager controlledRpcManager = new ControlledRpcManager(rpcManager);
      controlledRpcManager.blockBefore(StateResponseCommand.class);
      TestingUtil.replaceComponent(cache, RpcManager.class, controlledRpcManager, true);
      return controlledRpcManager;
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      }).when(spyCdl1).commitEntry(any(CacheEntry.class), any(EntryVersion.class), anyBoolean(),
            any(InvocationContext.class));
   }

   private ControlledRpcManager blockStateResponseCommand(final Cache cache) throws InterruptedException {
      RpcManager rpcManager = TestingUtil.extractComponent(cache, RpcManager.class);
      ControlledRpcManager controlledRpcManager = new ControlledRpcManager(rpcManager);
      controlledRpcManager.blockBefore(StateResponseCommand.class);
      TestingUtil.replaceComponent(cache, RpcManager.class, controlledRpcManager, true);
      return controlledRpcManager;
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      cache(3).put(k3, "v3");

      final StateTransferManager stm = cache(0).getAdvancedCache().getComponentRegistry().getStateTransferManager();
      int initialTopologyId = stm.getCacheTopology().getTopologyId();

      RpcManager rm = TestingUtil.extractComponent(cache(0), RpcManager.class);
      ControlledRpcManager crm = new ControlledRpcManager(rm);
      crm.blockBefore(StateRequestCommand.class);
      TestingUtil.replaceComponent(cache(0), RpcManager.class, crm, true);

      cache(3).stop();
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

         public CacheTopology answer(InvocationOnMock invocation) {
            return cacheTopology;
         }
      });
      replInterceptor.injectDependencies(commandsFactory, entryFactory, lockManager, dataContainer, stateTransferManager);
      RpcManager rpcManager = mock(RpcManager.class);
      Transport transport = mock(Transport.class);
      when(rpcManager.getAddress()).thenReturn(B);
      when(rpcManager.getTransport()).thenReturn(transport);
      when(transport.getMembers()).thenReturn(members2);
      replInterceptor.inject(rpcManager);
      replInterceptor.injectConfiguration(configuration);

      when(rpcManager.invokeRemotely(any(Collection.class), any(ClusteredGetCommand.class), any(ResponseMode.class),
            anyLong(), anyBoolean(), any(ResponseFilter.class))).thenAnswer(new Answer<Map<Address, Response>>() {
         @Override
         public Map<Address, Response> answer(InvocationOnMock invocation) {
            Collection<Address> recipients = (Collection<Address>) invocation.getArguments()[0];
            ClusteredGetCommand clusteredGetCommand = (ClusteredGetCommand) invocation.getArguments()[1];
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

   public void addListener(Object listener) {
      cache.addListener(listener);
   }

   public AddressAdapter getAddress() {
      RpcManager rpc = cache.getAdvancedCache().getRpcManager();
      if (rpc != null) {
         return AddressAdapterImpl.newInstance(rpc.getTransport().getAddress());
      }
      return null;
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      }
      return null;
   }

   public List<AddressAdapter> getMembers() {
      RpcManager rpc = cache.getAdvancedCache().getRpcManager();
      if (rpc != null) {
         return AddressAdapterImpl.toAddressAdapter(rpc.getTransport().getMembers());
      }
      return null;
   }
View Full Code Here

Examples of org.infinispan.remoting.rpc.RpcManager

      log.debugf("Defined and started cache %s", cacheNameToCreate);
      return true;
   }

   private void waitForClusterToForm(Cache<Object, Object> cache) throws InterruptedException {
      RpcManager rpcManager = cache.getAdvancedCache().getRpcManager();
      //wait till we see all the expected members
      while (rpcManager.getMembers().size() != size) {
         Thread.sleep(50);
      }
      //now make sure that all the expected members have also seen us
      //do this for 15 secs
      Address localAddress = cacheManager.getTransport().getAddress();
      for (int i = 0; i < 300; i++) {
         cache.getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.FORCE_ASYNCHRONOUS, Flag.SKIP_REMOTE_LOOKUP).put(localAddress, "0");
         boolean clusterFormed = true;
         for (Address a : rpcManager.getMembers()) {
            if (!cache.containsKey(a)) {
               clusterFormed = false;
               break;
            }
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.