public int getStatus() throws SystemException { return getSeamTransaction().getStatus(); }
@Override public void requestInitialized(ServletRequestEvent sre) { final String listenerDisabledParam = sre.getServletContext().getInitParameter(DISABLE_LISTENER_PARAM); if (listenerDisabledParam != null && "true".equals(listenerDisabledParam.trim().toLowerCase())) { return; } try { if (this.tx.getStatus() == Status.STATUS_ACTIVE) { this.log.warn("Transaction was already started before the listener"); } else { this.log.debugf("Beginning transaction for request %s", sre.getServletRequest()); this.tx.begin(); } } catch (SystemException se) { this.log.warn("Error starting the transaction, or checking status", se); this.txException.fire(new ExceptionToCatch(se)); } catch (NotSupportedException e) { this.log.warn("Error starting the transaction", e); this.txException.fire(new ExceptionToCatch(e)); } } }
public void markTransactionRollback(@Handles(precedence = Precedence.BUILT_IN, during = TraversalMode.BREADTH_FIRST) CaughtException<Throwable> t) { // Any exception that occurs is going to mark the transaction for rollback. try { switch (this.tx.getStatus()) { case Status.STATUS_ACTIVE: case Status.STATUS_COMMITTED: case Status.STATUS_COMMITTING: case Status.STATUS_MARKED_ROLLBACK: case Status.STATUS_PREPARED: case Status.STATUS_PREPARING: this.tx.setRollbackOnly(); break; case Status.STATUS_ROLLING_BACK: case Status.STATUS_UNKNOWN: case Status.STATUS_ROLLEDBACK: case Status.STATUS_NO_TRANSACTION: break; } } catch (SystemException e) { log.warn("Could not set transaction to rollback", e); } t.rethrow(); } }
switch (this.tx.getStatus()) { case Status.STATUS_ACTIVE: this.log.debugf("Committing a transaction for request %s", sre.getServletRequest());
if (newTransactionRequired && transaction.getStatus() != Status.STATUS_NO_TRANSACTION) { if (ExceptionUtil.exceptionCausesRollback(e)) { log.debug("rolling back transaction"); transaction.commit(); } else if (transaction.getStatus() != Status.STATUS_NO_TRANSACTION && ExceptionUtil.exceptionCausesRollback(e)) { transaction.setRollbackOnly();