Hi Oleg
That's what I was wondering, and I thought the newExpiry should take precedence, since each time I re-use a connection, I'd typically want to extend its life time. I guess re-using connections is my objective when using a connection pool, and thus, with each re-use the life time should extend, unless some request causes a connection close or non-reusable event where its discarded.public synchronized void updateExpiry(final long time, final TimeUnit tunit) { Args.notNull(tunit, "Time unit"); this.updated = System.currentTimeMillis(); long newExpiry; if (time > 0) { newExpiry = this.updated + tunit.toMillis(time); } else { newExpiry = Long.MAX_VALUE; } this.expiry = Math.min(newExpiry, this.validUnit); }Hi Asankha Let's say a pool entry is created at 10:00 with the total time to live of 10 minutes. The validUntil value is set to 10:10. Let's say at 10:05 #updateExpiry takes 10 minutes as input thus making newExpiry equal to 10:15. Should not validUntil still apply and take precedence over newExpiry? Oleg
When I created the original connection I state that it can be reused within another 10 minutes - i.e. until 10:10. When I do re-use it at 10:05, if I am to call updateExpiry() again, that indicates that I want to now "update" the expiry time which is currently set. Now if I say I want to re-use this again in the next 10 minutes, i.e. until 10:15, the new expiry time should be the max of validUntil and newExpiry
thanks and regards asankha -- Asankha C. Perera AdroitLogic, http://adroitlogic.org http://esbmagic.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
