public Transaction currentTransaction() {
        Transaction localTx = LOCAL_TRANSACTION.get();
        if (localTx != null) {
            return localTx;
        }
        try {
            javax.transaction.Transaction txn = txnMgr.getTransaction();
            if (txn == null) {
                // no active transaction
                return null;
            }
            if (Status.STATUS_ACTIVE != txn.getStatus()) {
                // there is a user transaction which is not valid, so abort everything
                throw new IllegalStateException(JcrI18n.errorInvalidUserTransaction.text(txn));
            }
            return transactionTable.get(txn);
        } catch (SystemException e) {
            logger.debug(e, "Cannot determine if there is an active transaction or not");
            return null;
        }

    }
public Transaction currentTransaction ( ) { Transaction localTx = LOCAL_TRANSACTION . get ( ) ; if ( localTx != null ) { return localTx ; } try { javax . transaction . Transaction txn = txnMgr . getTransaction ( ) ; if ( txn == null ) { return null ; } if ( Status . STATUS_ACTIVE != txn . getStatus ( ) ) { throw new IllegalStateException ( JcrI18n . errorInvalidUserTransaction . text ( txn ) ) ; } return transactionTable . get ( txn ) ; } catch ( SystemException e ) { logger . debug ( e , "Cannot determine if there is an active transaction or not" ) ; return null ; } }
Returns a the current ModeShape transaction, if one exists.
<p>
A ModeShape transaction may not necessarily exist when a
{@link javax.transaction.Transaction} is active. This is because ModeShape transactions are only created when a
{@link org.modeshape.jcr.JcrSession} is saved.
</p>

@return either a {@link org.modeshape.jcr.txn.Transactions.Transaction instance} or {@code null} if no ModeShape transaction
exists