Package javax.transaction

Examples of javax.transaction.TransactionManager.commit()


      cache.put(fqn, key, value);
      assertEquals(value, cache.get(fqn, key));
      assertNull(chainingCacheLoader.get(fqn));
      assertNull(loader1.get(fqn));
      assertNull(loader2.get(fqn));
      mgr.commit();
      assertEquals(value, cache.get(fqn, key));
      assertEquals(value, chainingCacheLoader.get(fqn).get(key));
      assertEquals(value, loader1.get(fqn).get(key));
      assertEquals(value, loader2.get(fqn).get(key));
View Full Code Here


      lis.put("/a/b/c", "age", 38);

      tm.suspend();
      assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
      tm.resume(tx);
      tm.commit();

      // value on cache2 must be 38
      age = (Integer) cache2.get("/a/b/c", "age");
      assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
      assertTrue("\"age\" must be 38", age == 38);
View Full Code Here

      map.put("name", "Ben");
      lis.put("/a/b/c", map);
      tm.suspend();
      assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
      tm.resume(tx);
      tm.commit();

      // value on cache2 must be 38
      age = (Integer) cache2.get("/a/b/c", "age");
      assertNotNull("\"age\" obtained from cache2 must be non-null ", age);
      assertTrue("\"age\" must be 38", age == 38);
View Full Code Here

      // force an IC scrub
      //cache[1].getInvocationContext().setOptionOverrides(null);
      cache[1].put(fqn, key, "value2");
      try
      {
         mgr.commit();

         assertTrue("expected to fail", false);
      }
      catch (RollbackException e)
      {
View Full Code Here

      mgr.begin();

      version = new TestVersion("999");
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      mgr.commit();
   }

   /**
    * This test sets a custom data version first, expects it to replicate, and then does a put on the remote
    * cache using a lower custom data version.  Should fail.
View Full Code Here

      version = new TestVersion("29");
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      try
      {
         mgr.commit();
         assertTrue("expected to fail", false);
      }
      catch (RollbackException e)
      {
         // should fail.
View Full Code Here

      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);

      try
      {
         cache[1].put(fqn, key, "value2");
         mgr.commit();
         assertTrue("expected to fail", false);
      }
      catch (Exception e)
      {
         // should fail.
View Full Code Here

      mgr.begin();

      DataVersion version = new DefaultDataVersion(300);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      mgr.commit();
   }

   /**
    * This test sets an implicit data version first, expects it to replicate, and then does a put on the remote
    * cache using a lower implicit data version.  Should fail.
View Full Code Here

      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      try
      {
         // this call will use implicit versioning and will hence fail.
         mgr.commit();
         assertTrue("expected to fail", false);
      }
      catch (Exception e)
      {
         // should fail.
View Full Code Here

      SamplePojo pojo = new SamplePojo(21, "test");

      cache.put("/one/two", "key1", pojo);

      mgr.commit();

      assertNull(mgr.getTransaction());
      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
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.