Example usage for org.apache.http.impl.conn.tsccm BasicPooledConnAdapter BasicPooledConnAdapter

List of usage examples for org.apache.http.impl.conn.tsccm BasicPooledConnAdapter BasicPooledConnAdapter

Introduction

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

Prototype

protected BasicPooledConnAdapter(final ThreadSafeClientConnManager tsccm, final AbstractPoolEntry entry) 

Source Link

Document

Creates a new adapter.

Usage

From source file:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.java

public ClientConnectionRequest requestConnection(final HttpRoute route, final Object state) {

    final PoolEntryRequest poolRequest = pool.requestPoolEntry(route, state);

    return new ClientConnectionRequest() {

        public void abortRequest() {
            poolRequest.abortRequest();//w ww. j a v  a 2 s  . co  m
        }

        public ManagedClientConnection getConnection(final long timeout, final TimeUnit tunit)
                throws InterruptedException, ConnectionPoolTimeoutException {
            Args.notNull(route, "Route");

            if (log.isDebugEnabled()) {
                log.debug("Get connection: " + route + ", timeout = " + timeout);
            }

            final BasicPoolEntry entry = poolRequest.getPoolEntry(timeout, tunit);
            return new BasicPooledConnAdapter(ThreadSafeClientConnManager.this, entry);
        }

    };

}