/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback, txid:" + transactionContext.getTransactionId()); } transactionContext.rollback(); }
/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback"); } transactionContext.rollback(); }
/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback, txid:" + transactionContext.getTransactionId()); } transactionContext.rollback(); }
/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback, txid:" + transactionContext.getTransactionId()); } transactionContext.rollback(); }
/** * Rolls back any messages done in this transaction and releases any locks * currently held. * * @throws JMSException if the JMS provider fails to roll back the * transaction due to some internal error. * @throws javax.jms.IllegalStateException if the method is not called by a * transacted session. */ @Override public void rollback() throws JMSException { checkClosed(); if (!getTransacted()) { throw new javax.jms.IllegalStateException("Not a transacted session"); } if (LOG.isDebugEnabled()) { LOG.debug(getSessionId() + " Transaction Rollback, txid:" + transactionContext.getTransactionId()); } transactionContext.rollback(); }
beforeEnd(); } catch (JMSException e) { rollback(); throw e;
@Test public void testSyncIndexCleared() throws Exception { final AtomicInteger beforeEndCountA = new AtomicInteger(0); final AtomicInteger rollbackCountA = new AtomicInteger(0); Synchronization sync = new Synchronization() { @Override public void beforeEnd() throws Exception { beforeEndCountA.getAndIncrement(); } @Override public void afterCommit() throws Exception { fail("expected rollback exception"); } @Override public void afterRollback() throws Exception { rollbackCountA.incrementAndGet(); } }; underTest.begin(); underTest.addSynchronization(sync); underTest.rollback(); assertEquals("beforeEnd", 1, beforeEndCountA.get()); assertEquals("rollback", 1, rollbackCountA.get()); // do it again underTest.begin(); underTest.addSynchronization(sync); underTest.rollback(); assertEquals("beforeEnd", 2, beforeEndCountA.get()); assertEquals("rollback", 2, rollbackCountA.get()); }