code: @SuppressWarnings("unchecked")
     private ManagedConnection open(Subject s) throws ResourceException
     {
        log.debugf("Open managed connection (%s)", s);
  
        if (recoverMC == null)
           recoverMC = mcf.createManagedConnection(s, null);
  
        if (plugin == null)
        {
           try
           {
              ValidatingManagedConnectionFactory vmcf = (ValidatingManagedConnectionFactory)mcf;
  
              Set connectionSet = new HashSet(1);
              connectionSet.add(recoverMC);
  
              Set invalid = vmcf.getInvalidConnections(connectionSet);
  
              if (invalid != null && !invalid.isEmpty())
              {
                 log.debugf("Invalid managed connection: %s", recoverMC);
  
                 close(recoverMC);
                 recoverMC = mcf.createManagedConnection(s, null);
              }
           }
           catch (ResourceException re)
           {
              log.debugf("Exception during invalid check", re);
  
              close(recoverMC);
              recoverMC = mcf.createManagedConnection(s, null);
           }
        }
  
        return recoverMC;
     }
docs: Open a managed connection
  @param s The subject
  @return The managed connection
  @exception ResourceException Thrown in case of an error