Package javax.transaction

Examples of javax.transaction.TransactionManager.rollback()


         try
         {
            Transaction tx = tm.getTransaction();
            if (trace)
               log.trace("UserTx rollback: " + tx);
            tm.rollback();
         }
         finally
         {
            // According to the spec, after commit and rollback was called on
            // UserTransaction, the thread is associated with no transaction.
View Full Code Here


        .retrieveTransactionManager();

    try {
      if ( transactionManager != null && transactionManager.getTransaction() != null ) {
        LOG.warn( "The test started a transaction but failed to commit it or roll it back. Going to roll it back." );
        transactionManager.rollback();
      }
    }
    catch (Exception e) {
      throw new RuntimeException( e );
    }
View Full Code Here

        Assert.assertNotNull(tm.getTransaction());
        tm.commit();

        tm.begin();
        Assert.assertNotNull(tm.getTransaction());
        tm.rollback();

        // Handler exposed
        ServiceReference ref = osgi.getServiceReference(HandlerFactory.class.getName(), "(&(handler.name=transaction)(handler.namespace=org.apache.felix.ipojo.transaction))");
        Assert.assertNotNull(ref);
View Full Code Here

                        habitat.getServiceHandle(TransactionManager.class);
                if (inhabitant != null && inhabitant.isActive()) {
                    TransactionManager txmgr = inhabitant.getService();
                    if (txmgr.getStatus() == Status.STATUS_ACTIVE
                            || txmgr.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
                        txmgr.rollback();
                    }
                }
            } catch (Throwable t) {
                logger.log(Level.SEVERE, "cleanupTransactions", t);
            }
View Full Code Here

      //make this chaing more robust
      assertThat( e.getCause().getCause().getMessage() ).isEqualTo( "Exploding type" );
    }
    finally {
      try {
        transactionManager.rollback();
      }
      catch ( Exception e ) {
        //we try
      }
      em.close();
View Full Code Here

         // ignoring timeout exception
      } catch (RemoteException e) {
         assert e.getCause() instanceof TimeoutException;
         // ignoring timeout exception
      } finally {
         tm.rollback();
      }
   }

   private void assertNotLocked(Cache<String, String> c, String key) throws SystemException, NotSupportedException {
      TransactionManager tm = TestingUtil.getTransactionManager(c);
View Full Code Here

      try {
         c.put(key, "dummy"); // should time out
      } catch (TimeoutException e) {
         assert false : "Should not have been locked!";
      } finally {
         tm.rollback();
      }
   }
}
View Full Code Here

      assert c1Replica.get("c1key").equals("c1value");
      assert c2.get("c2key").equals("c2value");
      assert c2Replica.get("c2key").equals("c2value");

      tm.resume(tx);
      tm.rollback();

      assert c1.get("c1key").equals("c1value");
      assert c1Replica.get("c1key").equals("c1value");
      assert c2.get("c2key").equals("c2value");
      assert c2Replica.get("c2key").equals("c2value");
View Full Code Here

      tm1.begin();
      assertSize(cache1, 2);
      cache1.put(new MagicKey("Need Also", cache1), "Speed");
      assertSize(cache1, 3);
      tm1.rollback();
      assertSize(cache1, 2);

      Map<Object, Object> atomicMap = createAtomicMap(cache1, new MagicKey("testSizeOnCache", cache1), true);
      assertSize(cache1, 3);
      atomicMap.put("mm", "nn");
View Full Code Here

      assertSize(cache1, 5);
      atomicMap = createAtomicMap(cache1, new MagicKey("testSizeOnCache-onemore", cache1), true);
      assertSize(cache1, 6);
      atomicMap.put("even less?", "weird!");
      assertSize(cache1, 6);
      tm1.rollback();
      assertSize(cache1, 4);
   }

   public void testConcurrentReadsOnExistingMap() throws Exception {
      final Cache<String, Object> cache1 = cache(0, "atomic");
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.