Hi, I'm using http client with a connection pool to execute RPCs in a remove host which drops connections after 1 min of inactivity. In my use case It’s really expensive to establish new connections so I would like to send a keepalive message from every open connection before expiration.
I've looked into the source of PoolingHttpClientConnectionManager and unfortunately I didn't find a way to implement this feature reusing existing pool implementation. I though in wrapping PoolingHttpClientConnectionManager and assigning a state to uniquely identify connections and request them when they are about to expire but it’s not the way to go. The state of the connection wasn't meant to be used this way. I don’t see any other option other than changing org.apache.http.pool.AbstractConnPool and add a new method with a callback to run on every active connection. I cannot use org.apache.http.pool.AbstractConnPool.enumAvailable because it’s too expensive. It locks the pool while the callbacks are running. I was thinking in copying the list of available connections (with lock) and try to lease and send my request one by one. Any other suggestion? Thank you.
