use of javax.jms.TransactionInProgressException in project activemq-artemis by apache.
the class ActiveMQRASession method commit.
/**
* Commit
*
* @throws JMSException Failed to close session.
*/
@Override
public void commit() throws JMSException {
if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) {
throw new TransactionInProgressException("XA connection");
}
lock();
try {
Session session = getSessionInternal();
if (cri.isTransacted() == false) {
throw new IllegalStateException("Session is not transacted");
}
if (ActiveMQRASession.trace) {
ActiveMQRALogger.LOGGER.trace("Commit session " + this);
}
session.commit();
} finally {
unlock();
}
}
use of javax.jms.TransactionInProgressException in project activemq-artemis by apache.
the class ActiveMQRASession method rollback.
/**
* Rollback
*
* @throws JMSException Failed to close session.
*/
@Override
public void rollback() throws JMSException {
if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) {
throw new TransactionInProgressException("XA connection");
}
lock();
try {
Session session = getSessionInternal();
if (cri.isTransacted() == false) {
throw new IllegalStateException("Session is not transacted");
}
if (ActiveMQRASession.trace) {
ActiveMQRALogger.LOGGER.trace("Rollback session " + this);
}
session.rollback();
} finally {
unlock();
}
}
Aggregations