Example usage for org.apache.http.impl.conn.tsccm PoolEntryRequest getPoolEntry

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

Introduction

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

Prototype

BasicPoolEntry getPoolEntry(long timeout, TimeUnit tunit)
        throws InterruptedException, ConnectionPoolTimeoutException;

Source Link

Document

Obtains a pool entry with a connection within the given timeout.

Usage

From source file:com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager.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();//from w w  w  . j a  v a2s .c o  m
        }

        public ManagedClientConnection getConnection(long timeout, TimeUnit tunit)
                throws InterruptedException, ConnectionPoolTimeoutException {
            if (route == null) {
                throw new IllegalArgumentException("Route may not be null.");
            }

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

            BasicPoolEntry entry = poolRequest.getPoolEntry(timeout, tunit);
            SoapUIBasicPooledConnAdapter connAdapter = new SoapUIBasicPooledConnAdapter(
                    SoapUIMultiThreadedHttpConnectionManager.this, entry);
            return connAdapter;
        }
    };

}

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 a2  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);
        }

    };

}