Am 2015-02-19 um 15:33 schrieb Oleg Kalnichevski:
On Thu, 2015-02-19 at 14:10 +0000, Pedro Ribeiro wrote:
Hi Oleg,
Thank you very much for your reply.
That's exactly what I was thinking, but instead of using enumAvailable
which blocks access to the pool, I would lock and get a copy of *available*
List*.* Then, for each connection available, try to lease one by one.
If the connection is not available anymore (we might have stale information
because we are outside the lock) continue otherwise send a keep-alive.
Would you be interested in a patch for this feature?
Pedro,
The problem with this approach is that one cannot lease a specific
connection. One can only lease an arbitrary connection matching the
lease criteria: route and state.
A much simpler solution to your problem might be just leasing, say, 5
connections every 5 minutes, sending a ping message on all them and
releasing them all back to the pool. This way your application would
always have approximately 5 live connections.
This is a good approach I would also recommend. The easiest way is with
a TimerTask which will issue a HEAD request.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]