code: public void returnConnectionListener(ConnectionListener cl, boolean kill) throws ResourceException
     {
        if (pool.getLogger().isTraceEnabled())
        {
           synchronized (this)
           {
              pool.getLogger().trace(ManagedConnectionPoolUtility.fullDetails(this,
                 "returnConnectionListener(" + Integer.toHexString(System.identityHashCode(cl)) + ", " + kill + ")",
                 pool.getConnectionManager().getManagedConnectionFactory(),
                 pool.getConnectionManager(),
                 pool, pool.getConfiguration(),
                 listeners, pool.getInternalStatistics(),
                 credential.getSubject(),
                 credential.getConnectionRequestInfo()));
           }
        }
        else if (pool.getLogger().isDebugEnabled())
        {
           pool.getLogger().debug(ManagedConnectionPoolUtility.details(
              "returnConnectionListener(" + Integer.toHexString(System.identityHashCode(cl)) + ", " + kill + ")",
              pool.getConfiguration().getId(),
              getCount(IN_USE, listeners),
              pool.getConfiguration().getMaxSize()));
        }
  
        if (pool.getJanitor().isRecording())
           pool.getJanitor().unregisterConnectionListener(cl);
  
        if (cl.getState() != DESTROYED && pool.getInternalStatistics().isEnabled())
        {
           pool.getInternalStatistics().deltaInUseCount(-1);
           pool.getInternalStatistics().deltaTotalUsageTime(System.currentTimeMillis() - cl.getFromPool());
        }
  
        if (!kill)
        {
           if (cl.changeState(IN_USE, TO_POOL))
           {
              try
              {
                 cl.getManagedConnection().cleanup();
                 cl.toPool();
                 if (!cl.changeState(TO_POOL, FREE))
                    kill = true;
              }
              catch (ResourceException re)
              {
                 kill = true;
              }
           }
           else
           {
              kill = true;
           }
        }
  
        if (kill && cl.getState() != DESTROYED)
        {
           try
           {
              if (Tracer.isEnabled())
                 Tracer.destroyConnectionListener(pool.getConfiguration().getId(),
                                                  this, cl, true, false, false, false, false,
                                                  false, false,
                                                  Tracer.isRecordCallstacks() ?
                                                  new Throwable("CALLSTACK") : null);
                       
              pool.destroyConnectionListener(cl);
           }
           finally
           {
              listeners.remove(cl);
           }
        }
     }
docs: {@inheritDoc}