On Mon, Aug 03, 2009 at 03:33:30PM -0700, Ken Krugler wrote: > Hi all, > > On http://hc.apache.org/httpcomponents-client/tutorial/html/ch02.html > the section titled "Connection keep alive strategy" talks about when to > implement a custom keep-alive strategy. > > But I thought that if a connection gets dropped by the server due to > inactivity, the next request made using that stale connection will > trigger an IOException, which HttpClient will automatically handle by > re-trying with a new connection. > > So is the issue that retrying winds up being less efficient, versus > auto-closing connections? Or is my understanding of what HttpClient 4 > will do with a stale connection too optimistic? > > Thanks, > > -- Ken > >
Ken, It is not necessarily less efficient but some folks just do not like the idea of getting an exception. Besides, if combined with a watcher thread evicting expired connection from the pool, ConnectionKeepAliveStrategy helps ensure connections get closed as they expire, instead of sitting in the pool indefinitely waiting for a request to be made. Overall, it just makes things cleaner. Oleg > -------------------------- > Ken Krugler > TransPac Software, Inc. > <http://www.transpac.com> > +1 530-210-6378 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
