The code that is being referred to is under this question on codereview forum.
When you do this HttpClientPool.getClient().execute(request), r) in the query method, you have used the client to send the HttpRequest.. Don't you need to release / clean up any resources ?
Does the monitor thread's
while ((stopRequest = stopSignal.poll(5, TimeUnit.SECONDS)) == null) {
// Close expired connections
cm.closeExpiredConnections();
// Optionally, close connections that have been idle too long.
cm.closeIdleConnections(60, TimeUnit.SECONDS);
// Look at pool stats.
log.trace("Stats: {}", cm.getTotalStats());
}
suffice to release the connection that is used by the client obtained from the pool.
A Few Questions :
- Does this mean that we let the connection expire OR go idle for them to be reclaimed by the pool ?
- What is the difference between expiry and going idle ?
- How are the physical connections, Connection objects, ConnectionManager objects, HttpClient objects' life cycles maintained and what is the relation between them ?
Sorry about the amateur questions. I am new to HttpClient.