Package javax.transaction

Examples of javax.transaction.TransactionManager.begin()



   public void testTxPutCommit() throws Exception
   {
      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();


      cache1.put(fqn, "key1", "val1");
      cache1.put("/one/two/three/four", "key2", "val2");
      assertNull(cache2.get(fqn, "key1"));
View Full Code Here


      CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");

      // with tx's
      TransactionManager txm = cache2.getTransactionManager();

      txm.begin();
      cache2.put(fqn, "key", "value");
      assertEquals("value", cache2.get(fqn, "key"));
      assertEquals("value2", cache1.get(fqn, "key2"));
      txm.commit();
View Full Code Here

      assertEquals("value", cache2.get(fqn, "key"));

      // now test the invalidation again
      txm = cache1.getTransactionManager();

      txm.begin();
      cache1.put(fqn, "key2", "value2");
      assertEquals("value", cache2.get(fqn, "key"));
      assertEquals("value2", cache1.get(fqn, "key2"));
      txm.commit();
View Full Code Here


   public void testTxPrepareAndRollback() throws Exception
   {
      final TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();

      cache1.getConfiguration().setLockAcquisitionTimeout(1500);
      cache2.getConfiguration().setLockAcquisitionTimeout(1500);

View Full Code Here

         public void run()
         {
            try
            {
               mgr.begin();
               tx2 = mgr.getTransaction();
               cache2.put(fqn, "block-key1", "block-val1");// acquires a lock on cache2./one/two/three
               TestingUtil.sleepThread(5000);
            }
            catch (Exception e)
View Full Code Here

      CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");

      // test a rollback
      txm = cache2.getTransactionManager();

      txm.begin();
      cache2.put(fqn, "key", "value");
      assertEquals("value2", cache1.get(fqn, "key2"));
      assertEquals("value", cache2.get(fqn, "key"));
      txm.rollback();
View Full Code Here

      TransactionManager tm2 = cache2.getConfiguration().getRuntimeConfig().getTransactionManager();
      tm1.begin();
      cache1.put(node, "k", "v-older");
      Transaction t1 = tm1.suspend();

      tm2.begin();
      cache2.put(node, "k", "v-newer");
      tm2.commit();

      tm1.resume(t1);
      try
View Full Code Here


   public void testPutAfterTxCommit() throws Exception
   {
      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();

      cache1.put(fqn, "key1", "val1");
      assertTrue(cache1.exists(fqn));
      mgr.commit();
      assertTrue(cache1.exists(fqn));
View Full Code Here

   }

   public void testPutAfterTxRollback() throws Exception
   {
      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();

      cache1.put(fqn, "key1", "val1");
      assertTrue(cache1.exists(fqn));
      mgr.rollback();
      assertFalse(cache1.getCacheLoaderManager().getCacheLoader().exists(fqn));
View Full Code Here

   {
      Fqn fqn = Fqn.fromString("/a/b");
      TransactionManager mgr = cache1.getTransactionManager();
      assertNull("Should be null", cache1.get(fqn, "key"));
      assertNull("Should be null", cache2.get(fqn, "key"));
      mgr.begin();
      cache1.put(fqn, "key", "value");
      assertEquals("value", cache1.get(fqn, "key"));
      mgr.commit();
      assertEquals("value", cache2.get(fqn, "key"));
      assertEquals("value", cache1.get(fqn, "key"));
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.