Package org.jboss.cache.marshall

Examples of org.jboss.cache.marshall.MethodCall


      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new TestAddress());
      //hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;

      List calls = dummy.getAllCalledIds();
      assertEquals(2, calls.size());

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      //      call our remote method
      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);

      TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
      assertTrue("Should be handled on the remote end without barfing, in the event of a rollback without a prepare", true);

      //we should have the commit as well now
View Full Code Here


      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new TestAddress());
      //hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      //our thread should be null
      assertNull(mgr.getTransaction());

      //   there should be a registration for the remote gtx
      assertNotNull(table.get(remoteGtx));
      assertNotNull(table.getLocalTransaction(remoteGtx));
      //assert that this is populated
      //assert that the remote prepare has populated the local workspace
      assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
      List calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));


      assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());

      //      call our remote method
      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
      }
      catch (Throwable t)
View Full Code Here

   @SuppressWarnings("deprecation")
   private MethodCall createMethodCall()
   {
      if (command == null) return null;
      MethodCall call = new MethodCall();
      call.setMethodId(command.getCommandId());
      call.setArgs(command.getParameters());
      return call;
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.marshall.MethodCall

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.