Package javax.transaction

Examples of javax.transaction.Transaction.rollback()


        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
        tm.begin();
        assertEquals(Status.STATUS_ACTIVE, tm.getStatus());
        Transaction tx = tm.getTransaction();
        assertNotNull(tx);
        tx.rollback();
        assertNotNull(tm.getTransaction());
        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());

        //check rollback when marked rollback only
        tm.begin();
View Full Code Here


        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
        tm.begin();
        Transaction tx = tm.getTransaction();
        tx.enlistResource(r1_1);
        tx.delistResource(r1_1, XAResource.TMSUCCESS);
        tx.rollback();
        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
        assertTrue(!r1_1.isCommitted());
        assertTrue(!r1_1.isPrepared());
        assertTrue(r1_1.isRolledback());
    }
View Full Code Here

        tx.enlistResource(r1_1);
        tx.delistResource(r1_1, XAResource.TMSUCCESS);
        tx.enlistResource(r1_2);
        tx.delistResource(r1_2, XAResource.TMSUCCESS);
        tx.setRollbackOnly();
        tx.rollback();
        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());
        assertTrue(!r1_1.isCommitted() & !r1_2.isCommitted());
        assertTrue(!r1_1.isPrepared() & !r1_2.isPrepared());
        assertTrue(r1_1.isRolledback() ^ r1_2.isRolledback());
    }
View Full Code Here

    public void testTxOp() throws Exception {
        Transaction tx;
        tm.begin();
        tx = tm.getTransaction();
        tx.rollback();
        assertEquals(Status.STATUS_NO_TRANSACTION, tx.getStatus());
        assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());

        tm.begin();
        assertFalse(tx.equals(tm.getTransaction()));
View Full Code Here

      {
         if (started != null)
         {
            try
            {
               started.rollback();
            }
            catch (Exception e)
            {
               JMSBridgeTest.log.error("Failed to rollback", e);
            }
View Full Code Here

      Transaction tx = getTransaction();
      if (tx == null)
      {
         throw new IllegalStateException("no transaction associated with thread");
      }
      tx.rollback();

      // Disassociate tx from thread.
      setTransaction(null);
   }
View Full Code Here

         assertNull(rm3);

         tx.delistResource(res, XAResource.TMSUCCESS);

         // Now rollback the tx - this should cause redelivery of the two messages
         tx.rollback();

         rm1 = (TextMessage)cons.receive(1000);

         assertNotNull(rm1);
View Full Code Here

         assertNull(rm3);
         tx.delistResource(res, XAResource.TMSUCCESS);

         // Now rollback the tx - this should cause redelivery of the two messages
         tx.rollback();

         rm1 = (TextMessage)cons.receive(1000);

         assertNotNull(rm1);
View Full Code Here

      {     
         if (started != null)
         {
            try
            {
               started.rollback();
            }
            catch (Exception e)
            {
               log.error("Failed to rollback", e);
            }
View Full Code Here

    public void rollback () throws IllegalStateException, SystemException,
            SecurityException
    {
        Transaction tx = getTransaction();
        if ( tx == null ) raiseNoTransaction();
        tx.rollback();
      
    }

    /**
     * @see javax.transaction.TransactionManager
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.