Example usage for org.apache.http.impl.conn CPoolEntry isRouteComplete

List of usage examples for org.apache.http.impl.conn CPoolEntry isRouteComplete

Introduction

In this page you can find the example usage for org.apache.http.impl.conn CPoolEntry isRouteComplete.

Prototype

public boolean isRouteComplete() 

Source Link

Usage

From source file:org.apache.http.impl.conn.PoolingHttpClientConnectionManager.java

public void releaseConnection(final HttpClientConnection managedConn, final Object state, final long keepalive,
        final TimeUnit tunit) {
    Args.notNull(managedConn, "Managed connection");
    synchronized (managedConn) {
        final CPoolEntry entry = CPoolProxy.detach(managedConn);
        if (entry == null) {
            return;
        }/* w w w.j av a  2 s .c  o m*/
        final ManagedHttpClientConnection conn = entry.getConnection();
        try {
            if (conn.isOpen()) {
                entry.setState(state);
                entry.updateExpiry(keepalive, tunit != null ? tunit : TimeUnit.MILLISECONDS);
                if (this.log.isDebugEnabled()) {
                    final String s;
                    if (keepalive > 0) {
                        s = "for " + (double) keepalive / 1000 + " seconds";
                    } else {
                        s = "indefinitely";
                    }
                    this.log.debug("Connection " + format(entry) + " can be kept alive " + s);
                }
            }
        } finally {
            this.pool.release(entry, conn.isOpen() && entry.isRouteComplete());
            if (this.log.isDebugEnabled()) {
                this.log.debug("Connection released: " + format(entry) + formatStats(entry.getRoute()));
            }
        }
    }
}