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:
ConnPoolControl<T>
Direct Known Subclasses:
BasicConnPool

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

Abstract blocking connection pool.

Since:
4.2

Constructor Summary
AbstractConnPool(int defaultMaxPerRoute, int maxTotal)
           
 
Method Summary
protected abstract  void closeEntry(E entry)
           
 void closeExpired()
           
 void closeIdle(long idletime, TimeUnit tunit)
           
protected abstract  C createConnection(T route)
           
protected abstract  E createEntry(T route, C conn)
           
 PoolStats getStats(T route)
           
 PoolStats getTotalStats()
           
 boolean isShutdown()
           
 Future<E> lease(T route, Object state)
           
 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(int defaultMaxPerRoute,
                        int maxTotal)
Method Detail

createConnection

protected abstract C createConnection(T route)
                               throws IOException
Throws:
IOException

createEntry

protected abstract E createEntry(T route,
                                 C conn)

closeEntry

protected abstract void closeEntry(E entry)

isShutdown

public boolean isShutdown()

shutdown

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

lease

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

release

public void release(E entry,
                    boolean reusable)

setMaxTotal

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

setDefaultMaxPerRoute

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

setMaxPerRoute

public void setMaxPerRoute(T route,
                           int max)
Specified by:
setMaxPerRoute 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.