/** * Get the session and ensure that it is open * * @return The session * @throws JMSException Thrown if an error occurs * @throws IllegalStateException The session is closed */ Session getSessionInternal() throws JMSException { if (mc == null) { throw new IllegalStateException("The session is closed"); } Session session = mc.getSession(); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getSessionInternal " + session + " for " + this); } return session; }
/** * Get the session and ensure that it is open * * @return The session * @throws JMSException Thrown if an error occurs * @throws IllegalStateException The session is closed */ Session getSessionInternal() throws JMSException { if (mc == null) { throw new IllegalStateException("The session is closed"); } Session session = mc.getSession(); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getSessionInternal " + session + " for " + this); } return session; }
/** * Commit * * @throws ResourceException Thrown if the operation fails */ @Override public void commit() throws ResourceException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("commit()"); } mc.lock(); try { if (mc.getSession().getTransacted()) { mc.getSession().commit(); } } catch (JMSException e) { throw new ResourceException("Could not commit LocalTransaction", e); } finally { //mc.setInManagedTx(false); mc.unlock(); } }
/** * Rollback * * @throws ResourceException Thrown if the operation fails */ @Override public void rollback() throws ResourceException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("rollback()"); } mc.lock(); try { if (mc.getSession().getTransacted()) { mc.getSession().rollback(); } } catch (JMSException ex) { throw new ResourceException("Could not rollback LocalTransaction", ex); } finally { //mc.setInManagedTx(false); mc.unlock(); } } }
/** * Commit * * @throws ResourceException Thrown if the operation fails */ @Override public void commit() throws ResourceException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("commit()"); } mc.lock(); try { if (mc.getSession().getTransacted()) { mc.getSession().commit(); } } catch (JMSException e) { throw new ResourceException("Could not commit LocalTransaction", e); } finally { //mc.setInManagedTx(false); mc.unlock(); } }
/** * Rollback * * @throws ResourceException Thrown if the operation fails */ @Override public void rollback() throws ResourceException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("rollback()"); } mc.lock(); try { if (mc.getSession().getTransacted()) { mc.getSession().rollback(); } } catch (JMSException ex) { throw new ResourceException("Could not rollback LocalTransaction", ex); } finally { //mc.setInManagedTx(false); mc.unlock(); } } }