Package javax.transaction

Examples of javax.transaction.TransactionManager.suspend()


      Transaction write = tm.suspend();

      // now start a read and confirm that the write doesn't block it.
      tm.begin();
      assert null == cache.get("k") : "Should not see uncommitted changes";
      Transaction read = tm.suspend();

      // commit the write
      tm.resume(write);
      tm.commit();
View Full Code Here


      Cache<String, String> cache = tl.cache;
      TransactionManager tm = tl.tm;
      cache.put("k", "v");
      tm.begin();
      assert "v".equals(cache.get("k"));
      Transaction reader = tm.suspend();

      tm.begin();
      cache.put("k", "v2");
      tm.rollback();
View Full Code Here

      LockTestBaseTL tl = threadLocal.get();
      Cache<String, String> cache = tl.cache;
      TransactionManager tm = tl.tm;
      tm.begin();
      assert null == cache.get("k");
      Transaction reader = tm.suspend();

      tm.begin();
      cache.put("k", "v");
      assert "v".equals(cache.get("k"));
      tm.rollback();
View Full Code Here

      mgr1.begin();
      cache1.put("key", "value2");
      Transaction tx1 = mgr1.suspend();
      mgr2.begin();
      cache2.put("key", "value3");
      Transaction tx2 = mgr2.suspend();
      mgr1.resume(tx1);
      // this oughtta fail
      try {
         replListener(cache2).expect(InvalidateCommand.class);
         mgr1.commit();
View Full Code Here

      // put
      tm.begin();
      Future<String> f = c1.putAsync(key, v);
      assert f != null;
      Transaction t = tm.suspend();
      assert c2.get(key) == null;
      tm.resume(t);
      assert f.get() == null;
      tm.commit();
      asyncWait(true, PutKeyValueCommand.class);
View Full Code Here

      assertOnAllCaches(key, v, c1, c2);

      tm.begin();
      f = c1.putAsync(key, v2);
      assert f != null;
      t = tm.suspend();
      assert c2.get(key).equals(v);
      tm.resume(t);
      assert !f.isCancelled();
      assert f.get().equals(v);
      tm.commit();
View Full Code Here

         @Override
         public boolean isSatisfied() throws Exception {
            return f2.isDone();
         }
      });
      t = tm.suspend();
      assert c2.get(key).equals(v2);
      tm.resume(t);
      assert !f2.isCancelled();
      assert f2.get() == null;
      tm.commit();
View Full Code Here

         @Override
         public boolean isSatisfied() throws Exception {
            return f1.isDone();
         }
      });
      t = tm.suspend();
      assert c2.get(key).equals(v3);
      tm.resume(t);
      assert !f1.isCancelled();
      assert f1.get().equals(v3);
      tm.commit();
View Full Code Here

         @Override
         public boolean isSatisfied() throws Exception {
            return f3.isDone();
         }
      });
      t = tm.suspend();
      assert c2.get(key).equals(v3);
      tm.resume(t);
      assert !f3.isCancelled();
      assert f3.get().equals(v3);
      tm.commit();
View Full Code Here

         public boolean isSatisfied() throws Exception {
            return f4.isDone();
         }
      });
      assert f4.isDone();
      t = tm.suspend();
      assert c2.get(key) == null;
      tm.resume(t);
      assert !f4.isCancelled();
      assert f4.get() == null;
      tm.commit();
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.