private void checkBadStateful(String ejbName) { int status = Status.STATUS_NO_TRANSACTION; try { status = tm.getStatus(); } catch (SystemException ex) { log.error("Failed to get status", ex); } switch (status) { case Status.STATUS_COMMITTING: case Status.STATUS_MARKED_ROLLBACK: case Status.STATUS_PREPARING: case Status.STATUS_ROLLING_BACK: try { tm.rollback(); } catch (Exception ex) { log.error("Failed to rollback", ex); } String msg = "BMT stateful bean '" + ejbName + "' did not complete user transaction properly status=" + TxUtils.getStatusAsString(status); log.error(msg); } }
@Override public void checkTransactionActive() throws RollbackException, SystemException { if (tm == null) throw new IllegalStateException("No transaction manager: " + ccmName); Transaction tx = tm.getTransaction(); if (tx != null) { int status = tx.getStatus(); // Only allow states that will actually succeed if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING) { if (status == Status.STATUS_MARKED_ROLLBACK && IGNORE_STATUS_MARKED_FOR_ROLLBACK) ; // allow database access even though transaction is marked to fail else throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status)); } } }
private void checkBadStateful() throws RemoteException { int status = Status.STATUS_NO_TRANSACTION; try { status = tm.getStatus(); } catch (SystemException ex) { log.error("Failed to get status", ex); } switch (status) { case Status.STATUS_COMMITTING : case Status.STATUS_MARKED_ROLLBACK : case Status.STATUS_PREPARING : case Status.STATUS_ROLLING_BACK : try { tm.rollback(); } catch (Exception ex) { log.error("Failed to rollback", ex); } String msg = "BMT stateful bean '" + container.getBeanMetaData().getEjbName() + "' did not complete user transaction properly status=" + TxUtils.getStatusAsString(status); log.error(msg); } }
if (threadTx == null || status != Status.STATUS_ACTIVE) String error = "Transaction " + threadTx + " is not active " + TxUtils.getStatusAsString(status); if (trace) log.trace(error + " cl=" + this);