code: public ManagedConnection associateManagedConnection(Object connection, ManagedConnectionFactory mcf,
                                                         ConnectionRequestInfo cri)
        throws ResourceException
     {
        log.tracef("associateManagedConnection(%s, %s, %s)", connection, mcf, cri);
        
        if (!this.mcf.equals(mcf))
        {
           throw new ResourceException();
        }
  
        if (connection == null)
           throw new ResourceException();
  
        Credential credential = null;
        if (getSubjectFactory() == null || cmConfiguration.getSecurityDomain() == null)
        {
           credential = new Credential(null, cri);
        }
        else
        {
           credential = new Credential(SecurityActions.createSubject(subjectFactory,
                                                                     cmConfiguration.getSecurityDomain(),
                                                                     mcf),
                                       cri);
        }
  
        return associateConnectionListener(credential, connection).getManagedConnection();
     }
docs: {@inheritDoc}