On Tue, 2006-08-15 at 15:13 -0700, Igor Lubashev wrote: > Great! > > Since the docs are rather sparse on this topic, do I need to call > releaseConnection() after abort()?
One must _always_ call HttpMethod#releaseConnection in order to make sure that the underlying connection gets returned to the pool. > Also, are abort() and/or > releaseConnection() idempotent? > One may safely invoke HttpMethod#abort and HttpMethod#releaseConnection methods multiple times. One may not however call HttpMethod#abort once HttpMethod#releaseConnection has been called. > While we are at it, I am planning to use the httpclient in my app by > getting the body as a stream and then reading data from that stream in > chunks, each chunk in a possibly different thread. That is, only one > thread will access the stream at a time, but the next time the stream is > accessed, it could be accessed from a different thread. Is this safe? > Or does httpclient use some ThreadLocal storage somewhere? > HttpClient does not use ThreadLocal-s. However, you have to provide proper synchronization when accessing HttpMethod instances from multiple threads. HttpMethod#abort is the only method of HttpMethod which is thread-safe. Oleg > Many thanks, > > - Igor > > > On Tue, 2006-08-15 at 14:47 -0700, Igor Lubashev wrote: > > Hi! > > > > I am new to this list, so I apologize if this topic has been beaten to > > death already. > > > > I am reading the tutorial, and it claims that I always must fully read > > the body of the response (of the GET method, for example) before > > releasing the connection. > > > > > > > > What should I do if I really do not care about the response body > (either > > because of the status code or because I suspect that the server is a > > rouge server and is sending me an infinite-sided body)? If there a > way > > to cleanly either abort the current method or cleanly kill the > > connection (and let the MultiThreadedHttpConnectionManager open > another > > one next time it is needed)? > > HttpMethod#abort is your friend > > Hope this helps > > Oleg > > > > --------------------------------------------------------------------- > 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]
