@ Override public TxCollaboratorConfig preInvoke ( final HttpServletRequest request , final boolean isServlet23 ) throws ServletException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling preInvoke. Request=" + request + " | isServlet23=" + isServlet23 ) ; } //First we check if there's a global transaction try { final EmbeddableWebSphereTransactionManager tranManager = getTranMgr ( ) ; if ( tranManager != null ) { final Transaction incumbentTx = tranManager . getTransaction ( ) ; if ( incumbentTx != null ) { TransactionImpl incumbentTxImpl = null ; if ( incumbentTx instanceof TransactionImpl ) incumbentTxImpl = ( TransactionImpl ) incumbentTx ; if ( incumbentTxImpl != null && incumbentTxImpl . getTxType ( ) == UOWCoordinator . TXTYPE_NONINTEROP_GLOBAL ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "the tx is NONINTEROP_GLOBAL set it to null" ) ; } // The following call should nullify the current tx on the current thread (in this special case where the // TxType is TXTYPE_NONINTEROP_GLOBAL tranManager . suspend ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Global transaction was present." ) ; } //Yes! There's a global transaction. Check for timeout checkGlobalTimeout ( ) ; //Create config return object final TxCollaboratorConfig retConfig = new TxCollaboratorConfig ( ) ; retConfig . setIncumbentTx ( incumbentTx ) ; return retConfig ; } } } } catch ( SystemException e ) { Tr . error ( tc , "UNEXPECTED_TRAN_ERROR" , e . toString ( ) ) ; ServletException se = new ServletException ( "Unexpected error during transaction fetching: " , e ) ; throw se ; } //Ensure we have a LocalTransactionCurrent to work with LocalTransactionCurrent ltCurrent = getLtCurrent ( ) ; if ( ltCurrent == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Unable to resolve LocalTransactionCurrent" ) ; } return null ; } //Create config return object TxCollaboratorConfig retConfig = new TxCollaboratorConfig ( ) ; // see if there is a local transaction on the thread LocalTransactionCoordinator ltCoord = ltCurrent . getLocalTranCoord ( ) ; if ( ltCoord != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Suspending LTC's coord: " + ltCoord ) ; } //there was a transaction! We need to suspend it and put its coordinator into the config //so that we can resume it later retConfig . setSuspendTx ( ltCurrent . suspend ( ) ) ; } //begin a new local transaction on the thread ltCurrent . begin ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Began LTC's coord:" + ltCurrent . getLocalTranCoord ( ) ) ; } return retConfig ; }
Collaborator preInvoke .