Package javax.transaction

Examples of javax.transaction.TransactionManager.begin()


      DataVersion version = new TestVersion("99");
      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

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


      DataVersion version = new TestVersion("99");
      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      version = new TestVersion("29");
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      try
View Full Code Here

   public void testIncompatibleVersionTypes2() throws Exception
   {
      cache[0].put(fqn, key, "value");// default data version should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      // explicitly set data version
      DataVersion version = new TestVersion("99");
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
View Full Code Here

   public void testCompatibleVersionTypes2() throws Exception
   {
      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

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

      DataVersion version = new DefaultDataVersion(200);
      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      version = new DefaultDataVersion(100);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      try
View Full Code Here

      CacheSPI<Object, Object> cache = createCacheWithListener();

      TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
      assertNull(mgr.getTransaction());

      mgr.begin();

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      SamplePojo pojo = new SamplePojo(21, "test");
View Full Code Here

      CacheSPI<String, String> cache = (CacheSPI<String, String>) new UnitTestCacheFactory<String, String>().createCache(c, MarkAsRollbackTest.class);
      try
      {
         TransactionManager tm = cache.getTransactionManager();
         assert tm != null;
         tm.begin();
         cache.put(fqn, "k", "v");
         assert cache.get(fqn, "k").equals("v");
         assert cache.getRoot().getChildren().size() == 1;
         tm.setRollbackOnly();
         try
View Full Code Here

      CacheSPI<String, String> cache = (CacheSPI<String, String>) new UnitTestCacheFactory<String, String>().createCache(c, MarkAsRollbackTest.class);
      try
      {
         TransactionManager tm = cache.getTransactionManager();
         assert tm != null;
         tm.begin();
         tm.setRollbackOnly();
         try
         {
            cache.put(fqn, "k", "v");
            assert false : "Should have failed";
View Full Code Here

      // Pause to give caches time to see each other
      TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cacheA, cacheB}, 60000);

      final TransactionManager tm = cacheB.getTransactionManager();
      tm.begin();
      final Transaction tx = tm.getTransaction();

      cacheB.put("/1/A", "1", "B");
      cacheB.put("/1/A", "2", "B");
      cacheB.put("/2/A", "1", "B");
View Full Code Here

   }

   private TransactionManager startTransaction() throws SystemException, NotSupportedException
   {
      TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
      mgr.begin();
      return mgr;
   }

}
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.