public void lazyEnlistInGlobalTran ( LazyEnlistableConnectionManager lazyEnlistableConnectionManager ) throws ResourceException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "lazyEnlist" , lazyEnlistableConnectionManager ) ; if ( tc . isDebugEnabled ( ) ) { String cId = null ; try { cId = mcf . getCorrelator ( this ) ; } catch ( SQLException x ) { // will just log the exception here and ignore it since its in trace Tr . debug ( this , tc , "got an exception trying to get the correlator in commit, exception is: " , x ) ; } if ( cId != null ) { StringBuffer stbuf = new StringBuffer ( 200 ) ; stbuf . append ( "Correlator: DB2, ID: " ) ; stbuf . append ( cId ) ; if ( xares != null ) { // doing this because otherwise, we will hvae an extra Begin that does't match commit/rollback stbuf . append ( " Transaction : " ) ; stbuf . append ( xares ) ; stbuf . append ( " BEGIN" ) ; } Tr . debug ( this , tc , stbuf . toString ( ) ) ; } } } // Signal the ConnectionManager directly to lazily enlist. if ( wasLazilyEnlistedInGlobalTran ) // Already enlisted; don't need to do anything. { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "lazyEnlist" , "already enlisted" ) ; } else { lazyEnlistableConnectionManager . lazyEnlist ( this ) ; // Indicate we lazily enlisted in the current transaction, if so. wasLazilyEnlistedInGlobalTran |= stateMgr . transtate != WSStateManager . NO_TRANSACTION_ACTIVE ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "lazyEnlist" , wasLazilyEnlistedInGlobalTran ) ; } }
Signal the Application Server for lazy enlistment if we aren t already enlisted in a transaction . The lazy enlistment signal should only be sent once for a transaction . Connection handles will always invoke this method when doing work in the database regardless of whether we are already enlisted . In the case where we are already enlisted this request should be ignored .