Package javax.transaction

Examples of javax.transaction.Transaction



   public void testTransactionRemovePutkeyValMethod() throws Exception
   {
      mgr.begin();
      Transaction tx = mgr.getTransaction();

      // inject InvocationContext
      cache.getInvocationContext().setTransaction(tx);
      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
View Full Code Here


   }

   public void testTransactionRemoveSubNodeMethod() throws Exception
   {
      mgr.begin();
      Transaction tx = mgr.getTransaction();

      // inject InvocationContext
      cache.getInvocationContext().setTransaction(tx);
      cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx, true));
View Full Code Here

   public void testStaleLocks() throws Exception
   {
      // scenario:
      // Thread starts tx in cache.  E.g., create and put into B
      tm.begin();
      final Transaction t = tm.getTransaction();
      final List exceptions = new ArrayList();

      cache.put(B, "k", "v");

      // now the container should attempt to rollback the tx in a separate thread.
      Thread rollbackThread = new Thread("RollbackThread")
      {
         public void run()
         {
            try
            {
               t.rollback();
            }
            catch (Exception e)
            {
               exceptions.add(e);
            }
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");
      cacheB.put("/2/A", "2", "B");
      cacheB.put("/1/A/I", "1", "B");
      cacheB.put("/1/A/I", "2", "B");
      cacheB.put("/EXISTS", "KEY", "B");

      Object monitor = new Object();
      HangSync sync = new HangSync(monitor);
      tx.registerSynchronization(sync);

      Thread t = new Thread()
      {
         public void run()
         {
View Full Code Here

      mgr.begin();

      cache.put("/one/two", "key1", "val1");
      int numLocksBefore = cache.getNumberOfLocksHeld();

      Transaction tx = mgr.suspend();

      cache.put("/a/b", "key1", "val1");
      mgr.resume(tx);

      assertEquals(numLocksBefore, cache.getNumberOfLocksHeld());
View Full Code Here

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      final DummyTransactionManager mgr = DummyTransactionManager.getInstance();
      mgr.begin();
      final Transaction tx = mgr.getTransaction();

      Runnable run = new Runnable()
      {

         public void run()
View Full Code Here

   public void testTxCreationCommit() throws Exception
   {
      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
      tm1.begin();
      Transaction tx = tm1.getTransaction();
      cache1.put(fqn, "key", "value");
      Map<String, String> data = new HashMap<String, String>();
      data.put("key", "value");

      List<Event> expected = new ArrayList<Event>();
View Full Code Here

   }

   public void testTxNonexistentRemove() throws Exception
   {
      tm1.begin();
      Transaction tx = tm1.getTransaction();
      cache1.removeNode("/does/not/exist");
      tm1.commit();
      List<Event> expected = new ArrayList<Event>();
      expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
      expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, true, null, TRANSACTION_COMPLETED));
View Full Code Here

   public void testTxCreationRollback() throws Exception
   {
      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
      tm1.begin();
      Transaction tx = tm1.getTransaction();
      cache1.put(fqn, "key", "value");
      Map<String, String> data = new HashMap<String, String>();
      data.put("key", "value");
      List<Event> expected = new ArrayList<Event>();
      expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
View Full Code Here

      assertEquals("Event log should be empty", Collections.emptyList(), eventLog1.events);
      assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);

      // modify existing node
      tm1.begin();
      Transaction tx = tm1.getTransaction();
      Map<String, String> newData = new HashMap<String, String>();
      newData.put("key", "value2");
      cache1.put(fqn, "key", "value2");
      List<Event> expected = new ArrayList<Event>();
      expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
View Full Code Here

TOP

Related Classes of javax.transaction.Transaction

Copyright © 2018 www.massapicom. 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.