Package javax.transaction

Examples of javax.transaction.TransactionManager.begin()


      // now make sure cache2 is in sync with cache1:
      // make sure this is in a tx
      TransactionManager txm = cache2.getTransactionManager();
      assertEquals("value", cache1.get(fqn, "key"));

      txm.begin();
      cache2.put(fqn, "key", "value");
      assertEquals("value", cache2.get(fqn, "key"));
      txm.commit();

      // since the node already exists even PL will not remove it - but will invalidate it's data
View Full Code Here


      // now test the invalidation again
      txm = cache1.getTransactionManager();
      assertEquals("value", cache2.get(fqn, "key"));

      txm.begin();
      cache1.put(fqn, "key2", "value2");
      assertEquals("value2", cache1.get(fqn, "key2"));
      txm.commit();

      assertEquals("value2", cache1.get(fqn, "key2"));
View Full Code Here

      // test a rollback
      txm = cache2.getTransactionManager();
      assertEquals("value2", cache1.get(fqn, "key2"));

      txm.begin();
      cache2.put(fqn, "key", "value");
      assertEquals("value", cache2.get(fqn, "key"));
      txm.rollback();

      assertEquals("value2", cache1.get(fqn, "key2"));
View Full Code Here

      TransactionManager mgr2 = cache2.getTransactionManager();

      mgr1.begin();
      cache1.put(fqn, "key2", "value2");
      Transaction tx1 = mgr1.suspend();
      mgr2.begin();
      cache2.put(fqn, "key3", "value3");
      Transaction tx2 = mgr2.suspend();
      mgr1.resume(tx1);
      // this oughtta fail
      try
View Full Code Here

      assertNull("Should be null", cache1.getNode(fqn));
      assertNull("Should be null", cache2.getNode(fqn));

      // OK, here's the real test
      TransactionManager tm = cache2.getTransactionManager();
      tm.begin();
      try
      {
         // Remove a node that doesn't exist in cache2
         cache2.removeNode(fqn);
         tm.commit();
View Full Code Here

      assertEquals("value", cache1.getNode(fqn).get("key"));
      assertNull("Should be null", cache2.getNode(fqn));

      // OK, here's the real test
      TransactionManager tm = cache2.getTransactionManager();
      tm.begin();
      try
      {
         // Remove a node that doesn't exist in cache2
         cache2.removeNode(fqn);
         tm.commit();
View Full Code Here

      Fqn fqn = Fqn.fromString("/a/b");
      TransactionManager mgr = caches.get(0).getTransactionManager();
      assertNull("Should be null", caches.get(0).get(fqn, "key"));
      assertNull("Should be null", caches.get(1).get(fqn, "key"));
      mgr.begin();
      caches.get(0).put(fqn, "key", "value");
      assertEquals("value", caches.get(0).get(fqn, "key"));
      assertNull("Should be null", caches.get(1).get(fqn, "key"));
      mgr.commit();
      assertEquals("value", caches.get(1).get(fqn, "key"));
View Full Code Here

      assertNull("Should be null", caches.get(1).get(fqn, "key"));
      mgr.commit();
      assertEquals("value", caches.get(1).get(fqn, "key"));
      assertEquals("value", caches.get(0).get(fqn, "key"));

      mgr.begin();
      caches.get(0).put(fqn, "key2", "value2");
      assertEquals("value2", caches.get(0).get(fqn, "key2"));
      assertNull("Should be null", caches.get(1).get(fqn, "key2"));
      mgr.rollback();
      assertEquals("value", caches.get(1).get(fqn, "key"));
View Full Code Here

      TransactionManager mgr2 = cache2.getTransactionManager();

      mgr1.begin();
      cache1.put(fqn, "key2", "value2");
      Transaction tx1 = mgr1.suspend();
      mgr2.begin();
      cache2.put(fqn, "key3", "value3");
      Transaction tx2 = mgr2.suspend();
      mgr1.resume(tx1);
      // this oughtta fail
      try
View Full Code Here

      TransactionManager mgr2 = cache2.getTransactionManager();

      mgr1.begin();
      cache1.put(fqn, "key2", "value2");
      Transaction tx1 = mgr1.suspend();
      mgr2.begin();
      cache2.put(fqn, "key3", "value3");
      Transaction tx2 = mgr2.suspend();
      mgr1.resume(tx1);
      // this oughtta fail
      try
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.