private void beforeAsyncOperation ( ) throws IllegalStateException , SecurityException { try { int status = transaction . getStatus ( ) ; if ( asyncOperationInitiated . getAndSet ( true ) || ( status != Status . STATUS_ACTIVE && status != Status . STATUS_MARKED_ROLLBACK ) ) { throw new IllegalStateException ( "There is no active tx, tx is in state: " + status ) ; } suspendIfAssoaciatedWithThread ( ) ; } catch ( SystemException e ) { throw new IllegalStateException ( e ) ; } }
Verifies if the wrapped transaction is active and if dissociates it from the thread if needed