hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Perman <...@permans.com>
Subject question on idle connections
Date Fri, 21 Nov 2014 20:46:10 GMT
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
​

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message