private void associateConnection ( ManagedConnectionFactory mcf , Subject subject , ConnectionRequestInfo cri , Object connection ) throws ResourceException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "associateConnection" ) ; UOWCurrent uowCurrent = ( UOWCurrent ) _pm . connectorSvc . transactionManager ; UOWCoordinator uowCoord = uowCurrent == null ? null : uowCurrent . getUOWCoord ( ) ; MCWrapper mcWrapper = null ; Object credTokenObj = null ; try { // Begin processing to get connection // Perform any security setup that may be needed // before we proceed to get a connection. credTokenObj = securityHelper . beforeGettingConnection ( subject , cri ) ; // Get an appropriate wrappered ManangedConnection. mcWrapper = allocateMCWrapper ( mcf , cri , subject , uowCoord ) ; } // end try block finally { // A "finally" clause is implemented to ensure // any thread identity pushed to the OS // thread is removed and the original identity // is restored. if ( credTokenObj != null ) { securityHelper . afterGettingConnection ( subject , cri , credTokenObj ) ; } } involveMCInTran ( mcWrapper , uowCoord , this ) ; // Reassociate the handle which was passed in with the ManagedConnection (via MCWrapper). // Note: since associateConnection is called to reassociate a smart handle which is // currently not associated to any MC, the fromMCWrapper parm in the call below will // be null. reassociateConnectionHandle ( connection , null , mcWrapper , uowCoord ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "associateConnection" ) ; }
not associated with a connection to get reassociated with a valid connection .