On Wed, 2010-06-16 at 17:55 +0200, Joan Balaguero wrote: > Hello, > > > > I have three questions abut keeupAlive: > > > > > > 1. If getKeepAliveDuration returns 0, that means: > > a. No keep alive > OR > b. Keep connections alive indefinitely. > >
Neither. It means the connection will be placed in the pool and will expire immediately. > > 2. If I want to remove the keep alive strategy, what should I do? Call > http.setKeepAliveStrategy(null)? > What do you mean by removing keep alive strategy? Not re-using connections at all? Anyways, you should implement a custom ConnectionKeepAliveStrategy if you want to customize the keep-alive time of persistent connections. If you so not want connections to be kept-alive at all (which is generally not recommended) you should implement a custom ConnectionReuseStrategy. > > > 3. At this moment, I have an IdleConnectionHandler that is triggered > every 30 seconds and does the following: > > > > this.cm.closeExpiredConnections(); > > this.cm.closeIdleConnections(this.idleTimeout, TimeUnit.SECONDS); > > > > But if I set a keep alive strategy, then its not necessary to call to > closeExpiredConnections, is it? > It is not necessary but recommended. Without #closeExpiredConnections an expired connection will remain in the pool until a request for a connection lease is made. You may really want to evict expired connections from the pool on a more regular basis. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
