public static boolean isActive(TransactionManager tm) { try { return isActive(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
public boolean isTransactional() { return TxUtils.isCompleted(tm) == false; }
protected boolean isTxExpired(Transaction miTx) throws Exception { return TxUtils.isRollback(miTx); }
public static boolean isUncommitted(TransactionManager tm) { try { return isUncommitted(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
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); } }
/** * AS7-6586 requires that the container avoid closing the EntityManager while the application * may be using the EntityManager in a different thread. If the transaction has been rolled * back, will check if the current thread is the Arjuna transaction manager Reaper thread. It is not * safe to call EntityManager.close from the Reaper thread, so false is returned. * * TODO: switch to depend on JBTM-1556 instead of checking the current thread name. * * @return */ private boolean safeToClose() { if (this.entityManager.isOpen()) { return !TxUtils.isTransactionManagerTimeoutThread(); } return true; }
public static boolean isUncommitted(TransactionManager tm) { try { return isUncommitted(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
@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)); } } }
/** * AS7-6586 requires that the container avoid closing the EntityManager while the application * may be using the EntityManager in a different thread. If the transaction has been rolled * back, will check if the current thread is the Arjuna transaction manager Reaper thread. It is not * safe to call EntityManager.close from the Reaper thread, so false is returned. * * TODO: switch to depend on JBTM-1556 instead of checking the current thread name. * * @return */ private boolean safeToClose() { if (this.entityManager.isOpen()) { return !TxUtils.isTransactionManagerTimeoutThread(); } return true; }
public static boolean isActive(TransactionManager tm) { try { return isActive(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
protected boolean isTxExpired(Transaction miTx) throws Exception { return TxUtils.isRollback(miTx); }
public static boolean isCompleted(TransactionManager tm) { try { return isCompleted(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
public static boolean isUncommitted(UserTransaction ut) { try { int status = ut.getStatus(); return isUncommitted(status); } catch (SystemException error) { throw new RuntimeException(error); } }
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); } }
public static boolean isActive(UserTransaction ut) { try { int status = ut.getStatus(); return isActive(status); } catch (SystemException error) { throw new RuntimeException(error); } }
public static boolean isRollback(TransactionManager tm) { try { return isRollback(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
public static boolean isCompleted(TransactionManager tm) { try { return isCompleted(tm.getTransaction()); } catch (SystemException error) { throw new RuntimeException(error); } }
public static boolean isUncommitted(UserTransaction ut) { try { int status = ut.getStatus(); return isUncommitted(status); } catch (SystemException error) { throw new RuntimeException(error); } }
if (threadTx == null || status != Status.STATUS_ACTIVE) String error = "Transaction " + threadTx + " is not active " + TxUtils.getStatusAsString(status); if (trace) log.trace(error + " cl=" + this);
public static boolean isInTx(TransactionManager transactionManager) { Transaction tx = getTransaction(transactionManager); if (tx == null || !TxUtils.isActive(tx)) return false; return true; }