protected synchronized void requestCallback ( Token token , Transaction transaction ) throws ObjectManagerException { final String methodName = "requestCallback" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , new Object [ ] { token , transaction } ) ; // To defend against two application threads completing the same transaction and trying to // continue with it at the same time we check that the Transaction still refers to this one, // now that we are synchronized on the InternalTransaction. if ( transaction . internalTransaction != this ) { if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { "via InvalidTransactionException" , transaction . internalTransaction } ) ; // Same behaviour as if the transaction was completed and replaced by // objectManagerState.dummyInternalTransaction. throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ; } // if (transaction.internalTransaction != this) // Make the state change, to see if we can accept requestCallBack requests. // We only accept the request if we will make a callback. setState ( nextStateForRequestCallback ) ; // The object is now listed for prePrepare etc. callback. callbackTokens . add ( token ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; }
Note a request for the Token in the transaction to be called at prePrepare preCommit preBackout postCommit and postBackout .