T - routeC - connection object@Contract(threading=SAFE) @Experimental public class LaxConnPool<T,C extends ModalCloseable> extends Object implements ManagedConnPool<T,C>
| Constructor and Description |
|---|
LaxConnPool(int defaultMaxPerRoute) |
LaxConnPool(int defaultMaxPerRoute,
TimeValue timeToLive,
PoolReusePolicy policy,
ConnPoolListener<T> connPoolListener) |
LaxConnPool(int defaultMaxPerRoute,
TimeValue timeToLive,
PoolReusePolicy policy,
DisposalCallback<C> disposalCallback,
ConnPoolListener<T> connPoolListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated
with it.
|
void |
closeExpired() |
void |
closeIdle(TimeValue idleTime) |
void |
enumAvailable(Callback<PoolEntry<T,C>> callback) |
void |
enumLeased(Callback<PoolEntry<T,C>> callback) |
int |
getDefaultMaxPerRoute() |
int |
getMaxPerRoute(T route) |
int |
getMaxTotal() |
Set<T> |
getRoutes() |
PoolStats |
getStats(T route) |
PoolStats |
getTotalStats() |
boolean |
isShutdown() |
Future<PoolEntry<T,C>> |
lease(T route,
Object state) |
Future<PoolEntry<T,C>> |
lease(T route,
Object state,
Timeout requestTimeout,
FutureCallback<PoolEntry<T,C>> callback)
Attempts to lease a connection for the given route and with the given
state from the pool.
|
void |
release(PoolEntry<T,C> entry,
boolean reusable)
Releases the pool entry back to the pool.
|
void |
setDefaultMaxPerRoute(int max) |
void |
setMaxPerRoute(T route,
int max) |
void |
setMaxTotal(int max) |
String |
toString() |
void |
validatePendingRequests() |
public LaxConnPool(int defaultMaxPerRoute,
TimeValue timeToLive,
PoolReusePolicy policy,
DisposalCallback<C> disposalCallback,
ConnPoolListener<T> connPoolListener)
public LaxConnPool(int defaultMaxPerRoute,
TimeValue timeToLive,
PoolReusePolicy policy,
ConnPoolListener<T> connPoolListener)
public LaxConnPool(int defaultMaxPerRoute)
public boolean isShutdown()
public void close(CloseMode closeMode)
ModalCloseableclose in interface ModalCloseablecloseMode - How to close the receiver.public void close()
close in interface Closeableclose in interface AutoCloseablepublic Future<PoolEntry<T,C>> lease(T route, Object state, Timeout requestTimeout, FutureCallback<PoolEntry<T,C>> callback)
ConnPoolPlease note the connection request can get automatically cancelled by the pool in case of a request timeout.
lease in interface ConnPool<T,C extends ModalCloseable>route - route of the connection.state - 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 null.requestTimeout - request timeout. In case of a timeout the request
can get automatically cancelled by the pool.callback - operation completion callback.public void release(PoolEntry<T,C> entry, boolean reusable)
ConnPoolrelease in interface ConnPool<T,C extends ModalCloseable>entry - pool entry leased from the poolreusable - flag indicating whether or not the released connection
is in a consistent state and is safe for further use.public void validatePendingRequests()
public void setMaxTotal(int max)
setMaxTotal in interface ConnPoolControl<T>public int getMaxTotal()
getMaxTotal in interface ConnPoolControl<T>public void setDefaultMaxPerRoute(int max)
setDefaultMaxPerRoute in interface ConnPoolControl<T>public int getDefaultMaxPerRoute()
getDefaultMaxPerRoute in interface ConnPoolControl<T>public void setMaxPerRoute(T route, int max)
setMaxPerRoute in interface ConnPoolControl<T>public int getMaxPerRoute(T route)
getMaxPerRoute in interface ConnPoolControl<T>public PoolStats getTotalStats()
getTotalStats in interface ConnPoolStats<T>public PoolStats getStats(T route)
getStats in interface ConnPoolStats<T>public Set<T> getRoutes()
getRoutes in interface ConnPoolControl<T>public void closeIdle(TimeValue idleTime)
closeIdle in interface ConnPoolControl<T>public void closeExpired()
closeExpired in interface ConnPoolControl<T>Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.