boolean transitionToStickyGlobalTran ( BeanId beanId , ContainerTx currentTx , ContainerTx expectedTx ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "transitionToStickyGlobalTran (" + beanId + "," + currentTx + ", " + expectedTx + ")" ) ; ContainerTx resumedTx = null ; EJSDeployedSupport s = getMethodContext ( ) ; EJBMethodInfoImpl methodInfo = s . methodInfo ; BeanMetaData bmd = beanId . getBeanMetaData ( ) ; try { // ----------------------------------------------------------------------- // First, complete the local transaction that was started early in // preInvoke with the normal postInvoke processing. // ----------------------------------------------------------------------- currentTx . postInvoke ( s ) ; uowCtrl . postInvoke ( beanId , s . uowCookie , s . exType , methodInfo ) ; // Clear to insure postInvoke we occur again if there are failures below. s . uowCtrlPreInvoked = false ; s . currentTx = null ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "transitionToStickyGlobalTran : local tx completed" ) ; // ----------------------------------------------------------------------- // Next, resume the sticky global transaction by executing the same // code that would normally happen early in preInvoke. // ----------------------------------------------------------------------- s . uowCookie = uowCtrl . preInvoke ( beanId , methodInfo ) ; s . uowCtrlPreInvoked = true ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "transitionToStickyGlobalTran : sticky global resumed" ) ; // Get the Container Transaction object (ContainerTx) associated // with the current transaction, as returned in the UOW Cookie // on UOW preInvoke. boolean isLocal = s . uowCookie . isLocalTx ( ) ; SynchronizationRegistryUOWScope UOWid = s . uowCookie . getTransactionalUOW ( ) ; resumedTx = getCurrentTx ( UOWid , isLocal ) ; s . currentTx = resumedTx ; resumedTx . preInvoke ( s ) ; // ----------------------------------------------------------------------- // Now complete the rest of the transaction processing that normally // occurs in preInvoke. // ----------------------------------------------------------------------- int isolationLevel = methodInfo . isolationAttr ; if ( bmd . ivModuleVersion <= BeanMetaData . J2EE_EJB_VERSION_1_1 || ( bmd . ivModuleVersion >= BeanMetaData . J2EE_EJB_VERSION_2_0 && bmd . cmpVersion == InternalConstants . CMP_VERSION_1_X ) ) { resumedTx . setIsolationLevel ( isolationLevel ) ; } s . currentIsolationLevel = isolationLevel ; } catch ( RemoteException rex ) { FFDCFilter . processException ( rex , CLASS_NAME + ".getBean" , "1542" , this ) ; // Something very unexpected, and ugly happened. Report this as an // EJBException, which will cause bean activation to fail. The method // context should be in an appropriate state that postInvoke will be // able to cleanup properly. throw ExceptionUtil . EJBException ( "A failure occured resuming a bean managed transaction" , rex ) ; } // ----------------------------------------------------------------------- // Return true only if expected 'sticky' transaction was indeed resumed. // It is possible that a different thread resumed the sticky transaction // first, so this thread will still just have a local transaction and // should continue to wait to lock the bean; false is returned. d671368.1 // ----------------------------------------------------------------------- if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "transitionToStickyGlobalTran : " + ( resumedTx == expectedTx ) ) ; return resumedTx == expectedTx ; }
d671368 d671368 . 1