Package org.jboss.cache

Examples of org.jboss.cache.RPCManager


public class App {

  public static void main(String[] args) {

    RPCManager manager = new RPCManagerImpl();
   
  }
View Full Code Here


      long startTime = System.currentTimeMillis();
      log.warn("Starting cache");
      cache.start();
      // now remove the existing RpcDispatcher and replace with one that is a noop.
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);
      RPCManager rpcManager = cr.getComponent(RPCManager.class);
      RpcDispatcher d = (RpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
      d.stop();
      RpcDispatcher replacement = new NoopDispatcher();
      replacement.setRequestMarshaller(d.getRequestMarshaller());
      replacement.setResponseMarshaller(d.getResponseMarshaller());
View Full Code Here

    * Builds a listener that will observe the given cache for recieving replication commands.
    */
   protected ReplicationListener(Cache cache)
   {
      ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
      RPCManager rpcManager = componentRegistry.getComponent(RPCManager.class);
      CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
      if (realDispatcher.setReplicationObserver(this) != null)
      {
         throw new RuntimeException("Replication listener already present");
      }
View Full Code Here

   public void testOOBFlag() throws Exception
   {
      DelegatingRPCManager delegatingRPCManager = new DelegatingRPCManager();
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(c1);
      RPCManager origRpcManager = cr.getComponent(RPCManager.class);
      delegatingRPCManager.delegate = origRpcManager;
      cr.registerComponent(delegatingRPCManager, RPCManager.class);
      cr.rewire();

      c1.getTransactionManager().begin();
View Full Code Here

      assert bm != null;

      StateTransferManager stm = (StateTransferManager) TestingUtil.extractField(bm, "stateTransferManager");
      assert stm != null;

      RPCManager rpcm = (RPCManager) TestingUtil.extractField(bm, "rpcManager");
      assert rpcm != null;

      RegionManager rm = (RegionManager) TestingUtil.extractField(bm, "regionManager");
      assert rm != null;
View Full Code Here

      return null;
   }

   public void testAsyncForce() throws Exception
   {
      RPCManager rpcManager = EasyMock.createNiceMock(RPCManager.class);
      RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
      List<Address> memberList = originalRpcManager.getMembers();
      expect(rpcManager.getMembers()).andReturn(memberList).anyTimes();
      // inject a mock RPC manager so that we can test whether calls made are sync or async.
      TestingUtil.extractComponentRegistry(cache1).registerComponent(RPCManager.class.getName(), rpcManager, RPCManager.class);

      // invalidations will not trigger any rpc call sfor PFER
View Full Code Here

         assertEquals("parent fqn tx should have completed", value, cache2.get(parentFqn, key));
   }

   public void testExceptionSuppression() throws Exception
   {
      RPCManager barfingRpcManager = EasyMock.createNiceMock(RPCManager.class);
      RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
      try
      {
         List<Address> memberList = originalRpcManager.getMembers();
         expect(barfingRpcManager.getMembers()).andReturn(memberList).anyTimes();
         expect(barfingRpcManager.getLocalAddress()).andReturn(originalRpcManager.getLocalAddress()).anyTimes();
         expect(barfingRpcManager.callRemoteMethods(anyAddresses(), (MethodCall) anyObject(), anyBoolean(), anyBoolean(), anyInt(), anyBoolean())).andThrow(new RuntimeException("Barf!")).anyTimes();
         replay(barfingRpcManager);

         TestingUtil.extractComponentRegistry(cache1).registerComponent(RPCManager.class.getName(), barfingRpcManager, RPCManager.class);
         cache1.getConfiguration().getRuntimeConfig().setRPCManager(barfingRpcManager);
View Full Code Here

    *
    * @throws Exception
    */
   private void cacheModeLocalTest(boolean transactional) throws Exception
   {
      RPCManager rpcManager = EasyMock.createMock(RPCManager.class);
      RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();

      // inject a mock RPC manager so that we can test whether calls made are sync or async.
      cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);

      // specify that we expect nothing will be called on the mock Rpc Manager.
View Full Code Here

   public void testQueueHoldAndFlush() throws Exception
   {
      assert replQ != null;

      // mock the RPCManager used in the cache
      RPCManager mockRpcManager = EasyMock.createStrictMock(RPCManager.class);
      injectRpcManager(mockRpcManager);

      // expect basic cluster related calls
      expect(mockRpcManager.getMembers()).andReturn(originalRpcManager.getMembers()).anyTimes();
      replay(mockRpcManager);

      // check that nothing on the RPCManager will be called until we hit the replication queue threshold.
      for (int i = 0; i < COUNT - 1; i++) cache.put("/a/b/c/" + i, "k", "v");
      assert replQ.elements.size() == COUNT - 1;

      // verify that no calls have been made on the mockRpcManager
      verify(mockRpcManager);

      // reset the mock
      reset(mockRpcManager);

      // now try the last PUT which should result in the queue being flushed.
      expect(mockRpcManager.getMembers()).andReturn(originalRpcManager.getMembers()).anyTimes();
      expect(mockRpcManager.callRemoteMethods((List<Address>) anyObject(), (MethodCall) anyObject(), anyBoolean(), anyBoolean(), anyInt(), anyBoolean())).andReturn(Collections.emptyList()).once();
      replay(mockRpcManager);

      cache.put("/a/b/c/LAST", "k", "v");
      assert replQ.elements.size() == 0;
View Full Code Here

      int expectedReplications = totalInvocations / COUNT;
      final CountDownLatch latch = new CountDownLatch(1);

      // mock the RPCManager used in the cache
      RPCManager mockRpcManager = EasyMock.createStrictMock(RPCManager.class);
      injectRpcManager(mockRpcManager);

      // expect basic cluster related calls
      expect(mockRpcManager.getMembers()).andReturn(originalRpcManager.getMembers()).anyTimes();
      expect(mockRpcManager.callRemoteMethods((List<Address>) anyObject(), (MethodCall) anyObject(), anyBoolean(), anyBoolean(), anyInt(), anyBoolean())).andReturn(Collections.emptyList()).times(expectedReplications);
      replay(mockRpcManager);

      Thread[] threads = new Thread[numThreads];

      for (int i = 0; i < numThreads; i++)
View Full Code Here

TOP

Related Classes of org.jboss.cache.RPCManager

Copyright © 2018 www.massapicom. 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.