Hello
We have had a persistent issue in production where after a few days our
PoolingClientConnectionManager becomes unusable because there are no
available connections. It turns out all of the available connections are
“leased” (according to the PoolStats).
I thought I was doing the right thing by writing an
IdleConnectionManagerThread as recommended in the docs. This thread will
call “closeExpiredConnections” and “closeIdleConnections” on a regular
interval.
Looking at the implementation of AbstractConnPool.closeExpired and
AbstractConnPool.closeIdle I don’t understand how they work. In our case,
all of our connections are “leased”… but these methods only ever iterate
and close connections that are “available”. How do I clean up leased
connections?
Iterator<E> it = this.*available*.iterator();
while (it.hasNext()) {
E entry = it.next();
if (entry.getUpdated() <= deadline) {
entry.close();
RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute());
pool.remove(entry);
it.remove();
notifyPending(pool);
}
}
thanks
sam