void _endActivity ( ActivityHandle handle , final SleeTransaction barrierTx ) throws UnrecognizedActivityHandleException { final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl ( raEntity , handle ) ; // get ac final ActivityContext ac = acFactory . getActivityContext ( ach ) ; if ( ac != null ) { // suspend activity if needed if ( barrierTx != null ) { final ActivityEventQueueManager aeqm = ac . getLocalActivityContext ( ) . getEventQueueManager ( ) ; aeqm . createBarrier ( barrierTx ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { aeqm . removeBarrier ( barrierTx ) ; } } ; final TransactionContext tc = barrierTx . getTransactionContext ( ) ; tc . getAfterCommitActions ( ) . add ( action ) ; tc . getAfterRollbackActions ( ) . add ( action ) ; } // end the activity ac . endActivity ( ) ; } else { throw new UnrecognizedActivityHandleException ( handle . toString ( ) ) ; } }
End activity logic independent of transaction management .