@Override public ClientConnectionRequest requestConnection(HttpRoute route, Object state) { // TODO Auto-generated method stub return super.requestConnection(route, state); } }
/** * Hook for creating the connection pool. * * @return the connection pool to use */ protected AbstractConnPool createConnectionPool(final HttpParams params) { AbstractConnPool acp = new ConnPoolByRoute(connOperator, params); boolean conngc = true; //@@@ check parameters to decide if (conngc) { acp.enableConnectionGC(); } return acp; }
public BasicPoolEntry getPoolEntry( long timeout, TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException { return getEntryBlocking(route, state, timeout, tunit, aborter); }
public int getConnectionsInPool(HttpRoute route) { poolLock.lock(); try { // don't allow a pool to be created here! RouteSpecificPool rospl = getRoutePool(route, false); return (rospl != null) ? rospl.getEntryCount() : 0; } finally { poolLock.unlock(); } }
@Override protected BasicPoolEntry getFreeEntry(RouteSpecificPool rospl, Object state) { BasicPoolEntry entry = super.getFreeEntry(rospl, state); if (entry != null) { freeEntryCounter.increment(); } return entry; }
@Override protected void deleteEntry(BasicPoolEntry entry) { deleteCounter.increment(); super.deleteEntry(entry); }
/** * Creates a new waiting thread. * Called by {@link #getRoutePool} when necessary. * * @param cond the condition to wait for * @param rospl the route specific pool, or <code>null</code> * * @return a waiting thread representation */ protected WaitingThread newWaitingThread(Condition cond, RouteSpecificPool rospl) { return new WaitingThread(cond, rospl); }
/** * If a waiting thread has been set, interrupts it. */ public void abort() { aborted = true; if (waitingThread != null) waitingThread.interrupt(); }
/** * Creates a new adapter. * * @param tsccm the connection manager * @param entry the pool entry for the connection being wrapped */ protected BasicPooledConnAdapter(ThreadSafeClientConnManager tsccm, AbstractPoolEntry entry) { super(tsccm, entry); markReusable(); }
public void closeIdleConnections(long idleTimeout, TimeUnit tunit) { // combine these two in a single call? connectionPool.closeIdleConnections(idleTimeout, tunit); connectionPool.deleteClosedConnections(); }
public void closeExpiredConnections() { connectionPool.closeExpiredConnections(); connectionPool.deleteClosedConnections(); }
public void abortRequest() { poolRequest.abortRequest(); }
/** * Gets the total number of pooled connections for the given route. * This is the total number of connections that have been created and * are still in use by this connection manager for the route. * This value will not exceed the maximum number of connections per host. * * @param route the route in question * * @return the total number of pooled connections for that route */ public int getConnectionsInPool(HttpRoute route) { return ((ConnPoolByRoute)connectionPool).getConnectionsInPool( route); }
/** * Creates a new route-specific pool. * Called by {@link #getRoutePool} when necessary. * * @param route the route * * @return the new pool */ protected RouteSpecificPool newRouteSpecificPool(HttpRoute route) { return new RouteSpecificPool(route, connPerRoute.getMaxForRoute(route)); }
@Override public void freeEntry(BasicPoolEntry entry, boolean reusable, long validDuration, TimeUnit timeUnit) { releaseCounter.increment(); super.freeEntry(entry, reusable, validDuration, timeUnit); }
@Override public PoolEntryRequest requestPoolEntry(HttpRoute route, Object state) { requestCounter.increment(); return super.requestPoolEntry(route, state); }
@Override public void shutdown() { super.shutdown(); if(Monitors.isObjectRegistered(name, this)) { Monitors.unregisterObject(name, this); } } }
public void shutdown() { connectionPool.shutdown(); }
@Override protected BasicPoolEntry getEntryBlocking(HttpRoute route, Object state, long timeout, TimeUnit tunit, WaitingThreadAborter aborter) throws ConnectionPoolTimeoutException, InterruptedException { Stopwatch stopWatch = requestTimer.start(); try { return super.getEntryBlocking(route, state, timeout, tunit, aborter); } finally { stopWatch.stop(); } }
/** * Sets the waiting thread. If this has already been aborted, * the waiting thread is immediately interrupted. * * @param waitingThread The thread to interrupt when aborting. */ public void setWaitingThread(WaitingThread waitingThread) { this.waitingThread = waitingThread; if (aborted) waitingThread.interrupt(); }