Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.NotifyingTransactionManager


      cache3.getConfiguration().setSyncRollbackPhase(syncCommitRollback);

      TransactionManager mgr1 = cache1.getTransactionManager();
      TransactionManager mgr2 = cache2.getTransactionManager();
      assertTrue(cache3.getTransactionManager() instanceof NotifyingTransactionManager);
      NotifyingTransactionManager mgr3 = (NotifyingTransactionManager) cache3.getTransactionManager();
      mgr3.setCache(cache3);

      assertSame(mgr1, mgr2);
      assertNotSame(mgr1, mgr3);
      assertNotSame(mgr2, mgr3);

      assertTrue(mgr1 instanceof DummyTransactionManager);
      assertTrue(mgr2 instanceof DummyTransactionManager);

      cache1.put("/test", "key", "value");

      assertEquals("value", cache1.get("/test", "key"));
      assertEquals("value", cache2.get("/test", "key"));
      assertEquals("value", cache3.get("/test", "key"));

      mgr3.setNotification(new TestNotification(abortBeforeCompletion));

      mgr1.begin();
      cache1.put("/test", "key", "value2");
      mgr1.commit();
View Full Code Here


      cache3.getConfiguration().setSyncRollbackPhase(syncCommitRollback);

      TransactionManager mgr1 = cache1.getTransactionManager();
      TransactionManager mgr2 = cache2.getTransactionManager();
      assertTrue(cache3.getTransactionManager() instanceof NotifyingTransactionManager);
      NotifyingTransactionManager mgr3 = (NotifyingTransactionManager) cache3.getTransactionManager();
      mgr3.setCache(cache3);

      assertSame(mgr1, mgr2);
      assertNotSame(mgr1, mgr3);
      assertNotSame(mgr2, mgr3);

      assertTrue(mgr1 instanceof DummyTransactionManager);
      assertTrue(mgr2 instanceof DummyTransactionManager);

      ReplicationListener cacheLister2 = ReplicationListener.getReplicationListener(cache2);
      ReplicationListener cacheLister3 = ReplicationListener.getReplicationListener(cache3);

      cacheLister2.expect(PutKeyValueCommand.class);
      cacheLister3.expect(PutKeyValueCommand.class);

      cache1.put("/test", "key", "value");
      cacheLister2.waitForReplicationToOccur();
      cacheLister3.waitForReplicationToOccur();

      assertEquals("value", cache1.get("/test", "key"));
      assertEquals("value", cache2.get("/test", "key"));
      assertEquals("value", cache3.get("/test", "key"));

      mgr3.setNotification(new TestNotification(abortBeforeCompletion));

      cacheLister2.expectWithTx(PutKeyValueCommand.class);
      cacheLister3.expectWithTx(PutKeyValueCommand.class);
      mgr1.begin();
      cache1.put("/test", "key", "value2");
View Full Code Here

TOP

Related Classes of org.jboss.cache.transaction.NotifyingTransactionManager

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.