protected void revokeConnection() {
    final ConnAdapter conn = managedConn;
    if (conn == null) {
      return;
    }
    conn.detach();

    synchronized (this) {
      try {
        uniquePoolEntry.shutdown();
      } catch (final IOException iox) {
        // ignore
        log.debug("Problem while shutting down connection.", iox);
      }
    }
  }
  public void releaseConnection(
      final ManagedClientConnection conn, final long validDuration, final TimeUnit timeUnit) {
    Args.check(
        conn instanceof ConnAdapter,
        "Connection class mismatch, " + "connection not obtained from this manager");
    assertStillUp();

    if (log.isDebugEnabled()) {
      log.debug("Releasing connection " + conn);
    }

    final ConnAdapter sca = (ConnAdapter) conn;
    synchronized (sca) {
      if (sca.poolEntry == null) {
        return; // already released
      }
      final ClientConnectionManager manager = sca.getManager();
      Asserts.check(manager == this, "Connection not obtained from this manager");
      try {
        // make sure that the response has been read completely
        if (sca.isOpen() && (this.alwaysShutDown || !sca.isMarkedReusable())) {
          if (log.isDebugEnabled()) {
            log.debug("Released connection open but not reusable.");
          }

          // make sure this connection will not be re-used
          // we might have gotten here because of a shutdown trigger
          // shutdown of the adapter also clears the tracked route
          sca.shutdown();
        }
      } catch (final IOException iox) {
        if (log.isDebugEnabled()) {
          log.debug("Exception shutting down released connection.", iox);
        }
      } finally {
        sca.detach();
        synchronized (this) {
          managedConn = null;
          lastReleaseTime = System.currentTimeMillis();
          if (validDuration > 0) {
            connectionExpiresTime = timeUnit.toMillis(validDuration) + lastReleaseTime;
          } else {
            connectionExpiresTime = Long.MAX_VALUE;
          }
        }
      }
    }
  }