Package javax.transaction

Examples of javax.transaction.TransactionManager.rollback()


         cache.put("/a/b/c", "test", "test");
         print(cache.exists("/a/b/c"));
         tm.commit();
      }
      catch (Exception ex) {
         tm.rollback();
         throw ex;
      }
   }

   private void print(Object s)
View Full Code Here


               // wait until the reader thread reads and allows me to rollback or until I timeout
               writerCanWrite.await(3, TimeUnit.SECONDS);

               System.out.println("rolling back");

               tm.rollback();
            }
            catch (AssertionError e)
            {
               writerError = e;
            }
View Full Code Here

      restartCache(c[0]);

      //assertEquals(4, cache.getNumberOfLocksHeld());
      assertEquals(0, c[0].getNumberOfNodes());

      tm.rollback();
      assertEquals(0, c[0].getNumberOfLocksHeld());
   }

   public void testStartNoCreate() throws Exception
   {
View Full Code Here

      TransactionManager mgr = TransactionSetup.getManager();
      try
      {
         if (mgr.getTransaction() != null)
         {
            mgr.rollback();
         }
      }
      catch (SystemException e)
      {
         // do nothing
View Full Code Here

      TransactionManager txManager = cache.getTransactionManager();
      txManager.begin();
      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(true);
      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
      txManager.rollback();
      assertTrue(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());

      txManager.begin();
      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(false);
      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
View Full Code Here

      txManager.begin();
      cache.getRoot().getChild(Fqn.fromString("/a/b")).setResident(true);
      cache.getRoot().getChild(Fqn.fromString("/a/b")).put("k2", "v2");
      assertEquals(cache.getRoot().getChild(Fqn.fromString("/a/b")).getKeys().size(), 2);
      txManager.rollback();
      assertTrue(cache.getRoot().getChild(Fqn.fromString("/a/b")).isResident());

      assert cache.getNumberOfLocksHeld() == 0 : "Should have no stale locks!";

      txManager.begin();
View Full Code Here

      mgr.begin();
      cache1.getInvocationContext().getOptionOverrides().reset();
      cache1.put("/a", key, "value1");
      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      cache1.put("/b", key, "value2");
      mgr.rollback();
      delay();
      // cache1 should NOT have this
      assert cache1.get("/a", key).equals("old");
      assert cache1.get("/b", key).equals("old");
View Full Code Here

               // wait until the second thread writes and allows me to rollback or until I timeout
               firstCanRollback.await(3000, TimeUnit.MILLISECONDS);

               System.out.println("rolling back");

               tm.rollback();

               assertNull("a1 empty", cache.get(a1, KEY));

               // notify the reading thread
               secondCanRead.countDown();
View Full Code Here

         assertTrue(rootNode.getChildren().contains(nodeB));
         assertTrue(nodeA.getChildren().isEmpty());
      }


      tm.rollback();

      nodeA = rootNode.getChild(A);
      nodeB = nodeA.getChild(B);

      // should revert
View Full Code Here

                case Status.STATUS_PREPARING:
                case Status.STATUS_ROLLING_BACK:
                case Status.STATUS_PREPARED:
                    try {
                        TransactionLogger.ROOT_LOGGER.transactionStillOpen(status);
                        tm.rollback();
                    } catch (Exception ex) {
                        TransactionLogger.ROOT_LOGGER.unableToRollBack(ex);
                    }
            }
        } catch (Exception e) {
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.