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

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

Introduction

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

Prototype

public boolean isRouteComplete() 

Source Link

Usage

From source file:org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.java

@Override
public void releaseConnection(final NHttpClientConnection 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;
        }/*from w w  w  .  j av a2s.  c  om*/
        if (this.log.isDebugEnabled()) {
            this.log.debug("Releasing connection: " + format(entry) + formatStats(entry.getRoute()));
        }
        final NHttpClientConnection 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()));
            }
        }
    }
}

From source file:org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.java

@Override
public boolean isRouteComplete(final NHttpClientConnection managedConn) {
    Args.notNull(managedConn, "Managed connection");
    synchronized (managedConn) {
        final CPoolEntry entry = CPoolProxy.getPoolEntry(managedConn);
        return entry.isRouteComplete();
    }/* w  w  w  .jav a 2 s .  c om*/
}