org.apache.http.pool
Class AbstractConnPool<T,C,E extends PoolEntry<T,C>>

java.lang.Object
  extended by org.apache.http.pool.AbstractConnPool<T,C,E>
Type Parameters:
T - route
C - connection object
E - pool entry
All Implemented Interfaces:
ConnPool<T,E>, ConnPoolControl<T>
Direct Known Subclasses:
BasicConnPool

@ThreadSafe
public abstract class AbstractConnPool<T,C,E extends PoolEntry<T,C>>
extends Object
implements ConnPool<T,E>, ConnPoolControl<T>

Abstract blocking connection pool.

Since:
4.2

Constructor Summary
AbstractConnPool(ConnFactory<T,C> connFactory, int defaultMaxPerRoute, int maxTotal)
           
 
Method Summary
 void closeExpired()
           
 void closeIdle(long idletime, TimeUnit tunit)
           
protected abstract  E createEntry(T route, C conn)
           
 int getDefaultMaxPerRoute()
           
 int getMaxPerRoute(T route)
           
 int getMaxTotal()
           
 PoolStats getStats(T route)
           
 PoolStats getTotalStats()
           
 boolean isShutdown()
           
 Future<E> lease(T route, Object state)
           
 Future<E> lease(T route, Object state, FutureCallback<E> callback)
           
 void release(E entry, boolean reusable)
           
 void setDefaultMaxPerRoute(int max)
           
 void setMaxPerRoute(T route, int max)
           
 void setMaxTotal(int max)
           
 void shutdown(long waitMs)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractConnPool

public AbstractConnPool(ConnFactory<T,C> connFactory,
                        int defaultMaxPerRoute,
                        int maxTotal)
Method Detail

createEntry

protected abstract E createEntry(T route,
                                 C conn)

isShutdown

public boolean isShutdown()

shutdown

public void shutdown(long waitMs)
              throws IOException
Throws:
IOException

lease

public Future<E> lease(T route,
                       Object state,
                       FutureCallback<E> callback)
Specified by:
lease in interface ConnPool<T,E extends PoolEntry<T,C>>

lease

public Future<E> lease(T route,
                       Object state)

release

public void release(E entry,
                    boolean reusable)
Specified by:
release in interface ConnPool<T,E extends PoolEntry<T,C>>

setMaxTotal

public void setMaxTotal(int max)
Specified by:
setMaxTotal in interface ConnPoolControl<T>

getMaxTotal

public int getMaxTotal()
Specified by:
getMaxTotal in interface ConnPoolControl<T>

setDefaultMaxPerRoute

public void setDefaultMaxPerRoute(int max)
Specified by:
setDefaultMaxPerRoute in interface ConnPoolControl<T>

getDefaultMaxPerRoute

public int getDefaultMaxPerRoute()
Specified by:
getDefaultMaxPerRoute in interface ConnPoolControl<T>

setMaxPerRoute

public void setMaxPerRoute(T route,
                           int max)
Specified by:
setMaxPerRoute in interface ConnPoolControl<T>

getMaxPerRoute

public int getMaxPerRoute(T route)
Specified by:
getMaxPerRoute in interface ConnPoolControl<T>

getTotalStats

public PoolStats getTotalStats()
Specified by:
getTotalStats in interface ConnPoolControl<T>

getStats

public PoolStats getStats(T route)
Specified by:
getStats in interface ConnPoolControl<T>

closeIdle

public void closeIdle(long idletime,
                      TimeUnit tunit)

closeExpired

public void closeExpired()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.