Please note that this class does not maintain its own pool of execution Threads.
Therefore, one must call Future#get() or Future#get(long, TimeUnit)
method on the Future object returned by the
lease(Object, Object, FutureCallback) method in order for the lease operation
to complete.
| Modifier and Type | Field and Description |
|---|---|
| private final LinkedList | |
| private final Condition | |
| private final ConnFactory | |
| private volatile int | |
| private volatile boolean | |
| private final Set | |
| private final Lock | |
| private final Map | |
| private volatile int | |
| private final LinkedList | |
| private final Map | |
| private volatile int |
| Access | Constructor and Description |
|---|---|
| public | AbstractConnPool(final ConnFactory<T, C> connFactory, final int defaultMaxPerRoute, final int maxTotal)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| protected abstract E | |
| protected void | |
| protected void | |
| public int | |
| private int | |
| public int | |
| public int | |
| private RouteSpecificPool | |
| private E | getPoolEntryBlocking(final T route, final Object state, final long timeout, final TimeUnit timeUnit, final Future<E> future)
|
| public Set | |
| public PoolStats | |
| public PoolStats | |
| public int | |
| public boolean | |
| public Future | lease(final T
route of the connection. route, final Object arbitrary object that represents a particular state
(usually a security principal or a unique token identifying
the user whose credentials have been used while establishing the connection).
May be state, final FutureCallback<E> null.operation completion callback. callback)Implements org. |
| public Future | Returns: future for a leased pool entry.route of the connection. route, final Object arbitrary object that represents a particular state
(usually a security principal or a unique token identifying
the user whose credentials have been used while establishing the connection).
May be state)null.Attempts to lease a connection for the given route and with the given state from the pool. |
| protected void | |
| protected void | |
| protected void | |
| private static Exception | |
| private void | |
| public void | release(final E
pool entry leased from the pool entry, final boolean flag indicating whether or not the released connection
is in a consistent state and is safe for further use. reusable)Implements org. |
| public void | setDefaultMaxPerRoute(final int max)
Implements org. |
| public void | setMaxPerRoute(final T route, final int max)
Implements org. |
| public void | |
| public void | |
| public void | |
| public String | |
| protected boolean |
| available | back to summary |
|---|---|
| private final LinkedList<E> available | |
| condition | back to summary |
|---|---|
| private final Condition condition | |
| connFactory | back to summary |
|---|---|
| private final ConnFactory<T, C> connFactory | |
| defaultMaxPerRoute | back to summary |
|---|---|
| private volatile int defaultMaxPerRoute | |
| isShutDown | back to summary |
|---|---|
| private volatile boolean isShutDown | |
| leased | back to summary |
|---|---|
| private final Set<E> leased | |
| lock | back to summary |
|---|---|
| private final Lock lock | |
| maxPerRoute | back to summary |
|---|---|
| private final Map<T, Integer> maxPerRoute | |
| maxTotal | back to summary |
|---|---|
| private volatile int maxTotal | |
| pending | back to summary |
|---|---|
| private final LinkedList<Future<E>> pending | |
| routeToPool | back to summary |
|---|---|
| private final Map<T, RouteSpecificPool<T, C, E>> routeToPool | |
| validateAfterInactivity | back to summary |
|---|---|
| private volatile int validateAfterInactivity | |
| AbstractConnPool | back to summary |
|---|---|
| public AbstractConnPool(final ConnFactory<T, C> connFactory, final int defaultMaxPerRoute, final int maxTotal) | |
| closeExpired | back to summary |
|---|---|
| public void closeExpired() Closes expired connections and evicts them from the pool. | |
| closeIdle | back to summary |
|---|---|
| public void closeIdle(final long idletime, final TimeUnit timeUnit) Closes connections that have been idle longer than the given period of time and evicts them from the pool.
| |
| createEntry | back to summary |
|---|---|
| protected abstract E createEntry(T route, C conn) Creates a new entry for the given connection with the given route. | |
| enumAvailable | back to summary |
|---|---|
| protected void enumAvailable(final PoolEntryCallback<T, C> callback) Enumerates all available connections.
| |
| enumLeased | back to summary |
|---|---|
| protected void enumLeased(final PoolEntryCallback<T, C> callback) Enumerates all leased connections.
| |
| getDefaultMaxPerRoute | back to summary |
|---|---|
| public int getDefaultMaxPerRoute() Implements org.
| |
| getMax | back to summary |
|---|---|
| private int getMax(final T route) | |
| getMaxPerRoute | back to summary |
|---|---|
| public int getMaxPerRoute(final T route) Implements org.
| |
| getMaxTotal | back to summary |
|---|---|
| public int getMaxTotal() Implements org.
| |
| getPool | back to summary |
|---|---|
| private RouteSpecificPool | |
| getPoolEntryBlocking | back to summary |
|---|---|
| private E getPoolEntryBlocking(final T route, final Object state, final long timeout, final TimeUnit timeUnit, final Future<E> future) throws IOException, InterruptedException, ExecutionException, TimeoutException | |
| getRoutes | back to summary |
|---|---|
| public Set Returns snapshot of all knows routes
| |
| getStats | back to summary |
|---|---|
| public PoolStats getStats(final T route) Implements org.
| |
| getTotalStats | back to summary |
|---|---|
| public PoolStats getTotalStats() Implements org.
| |
| getValidateAfterInactivity | back to summary |
|---|---|
public int getValidateAfterInactivity()
| |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() | |
| lease | back to summary |
|---|---|
| public Future Implements org. Doc from org. Attempts to lease a connection for the given route and with the given state from the pool.
Please note that this class does not maintain its own pool of execution
| |
| lease | back to summary |
|---|---|
| public Future Attempts to lease a connection for the given route and with the given state from the pool.
Please note that this class does not maintain its own pool of execution
| |
| onLease | back to summary |
|---|---|
protected void onLease(final E entry)
| |
| onRelease | back to summary |
|---|---|
protected void onRelease(final E entry)
| |
| onReuse | back to summary |
|---|---|
protected void onReuse(final E entry)
| |
| operationAborted | back to summary |
|---|---|
| private static Exception operationAborted() | |
| purgePoolMap | back to summary |
|---|---|
| private void purgePoolMap() | |
| release | back to summary |
|---|---|
| public void release(final E entry, final boolean reusable) Implements org. Doc from org. Releases the pool entry back to the pool.
| |
| setDefaultMaxPerRoute | back to summary |
|---|---|
| public void setDefaultMaxPerRoute(final int max) Implements org.
| |
| setMaxPerRoute | back to summary |
|---|---|
| public void setMaxPerRoute(final T route, final int max) Implements org.
| |
| setMaxTotal | back to summary |
|---|---|
| public void setMaxTotal(final int max) Implements org.
| |
| setValidateAfterInactivity | back to summary |
|---|---|
public void setValidateAfterInactivity(final int ms)
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() throws IOException Shuts down the pool. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| validate | back to summary |
|---|---|
protected boolean validate(final E entry)
| |