Package javax.transaction

Examples of javax.transaction.TransactionManager.commit()


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

      assertEquals("value2", cache1.get(fqn, "key2"));
      n2 = cache2.getNode(fqn);
      CacheLoaderInvalidationTest.assertHasBeenInvalidated(n2, "Should have been invalidated");
      CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
View Full Code Here


      cache1.put(fqn, "key1", "val1");
      cache1.put("/one/two/three/four", "key2", "val2");

      try
      {
         mgr.commit();// prepare() on cache2 will fail due to lock held by locker thread
         fail("commit() should fail because we cannot acquire the lock on cache2");
      }
      catch (RollbackException rollback)
      {
         assertTrue(true);
View Full Code Here

      cache1.put(node, "k", "v-older");
      Transaction t1 = tm1.suspend();

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

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

      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();

      cache1.put(fqn, "key1", "val1");
      assertTrue(cache1.exists(fqn));
      mgr.commit();
      assertTrue(cache1.exists(fqn));
      cache1.put("/a/b/c", null);// should be run outside a TX !
      assertTrue(cache1.exists("/a/b/c"));
   }
View Full Code Here

      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"));

      mgr.begin();
      cache1.put(fqn, "key2", "value2");
View Full Code Here

      HashMap<Object, Object> map = new HashMap<Object, Object>();
      map.put("1", "1");
      map.put("2", "2");
      cache1.put(Fqn.fromString("/aop/2"), map);
      cache1.removeNode(Fqn.fromString("/aop/2"));
      tm.commit();

//      TestingUtil.sleepThread(1000);
      if (useMarshalledValues) resetContextClassLoader();
   }
View Full Code Here

      }

      TransactionManager tm = beginTransaction();
      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
      cache1.put(aop, "person", srtl.ben_);
      tm.commit();
      if (useMarshalledValues) resetContextClassLoader();

      Object ben2;
      // Can't cast it to Person. CCE will resutl.
      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(clb);
View Full Code Here

         tm.begin();
         assert cache.getNode(fqn.getParent().getParent()).getChildrenNames().size() == 1;
         // watch here:
         int sz = cache.getNode(fqn.getParent()).getChildrenNames().size();
         assert sz == 1 : "Expecting 1, was " + sz;
         tm.commit();
      }
      finally
      {
         TestingUtil.killCaches(cache);
      }
View Full Code Here

         tx.registerSynchronization(sync);

         cache.put(fqn, "KEY", value);

         // Committing the tx will hang the thread
         tm.commit();
      }

      boolean isAsleep()
      {
         return sync.asleep;
View Full Code Here

      cache1.put(Fqn.fromString("/replicate"), "k", "v");
      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      cache1.put(Fqn.fromString("/not-replicate"), "k", "v");

      mgr.commit();
      Thread.sleep(3000);

      assertEquals("v", cache1.get("/replicate", "k"));
      assertEquals("v", cache1.get("/not-replicate", "k"));
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.