private Object executeImmutableTransaction ( ManagedMethodSPI managedMethod , Object [ ] args ) throws Throwable { Transaction transaction = transactionalResource . createReadOnlyTransaction ( ) ; // see mutable transaction comment transactionalResource . storeSession ( transaction . getSession ( ) ) ; try { Object result = managedMethod . invoke ( managedInstance , args ) ; if ( transaction . unused ( ) ) { log . debug ( "Method |%s| superfluously declared transactional." , managedMethod ) ; } return result ; } catch ( Throwable throwable ) { throw throwable ( throwable , "Immutable transactional method |%s| invocation fail." , managedMethod ) ; } finally { if ( transaction . close ( ) ) { // see mutable transaction comment transactionalResource . releaseSession ( ) ; } } }
Helper method for immutable transaction execution .