hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Cancelling HttpMethods
Date Wed, 11 Jan 2006 18:03:52 GMT
On Wed, 2006-01-11 at 17:55 +0100, Oliver Köll wrote:
> Hi,
> 
> Happy New Year to all, and congratulations for the 3.0 release.
> 
> I'm working on a GUI program, where HttpMethods are executed on the 
> request of the user. As e.g. in a Webbrowser, I would like to enable 
> unpatient users to cancel requests that take too long.
> 
> I currently don't see any possibilities to cancel a running request from 
>   a separate thread, though. Neither HttpMethod.abort() nor 
> Thread.interrupt() have any effect. 

Oliver

HttpMethod#abort closes the underlying socket. This effectively kills
the connection. What other effect do you expect? 


> The only remaining option appears to 
> be pushing pending requests in the background and letting them 
> terminate/timeout silently. I'd be interested in hearing how other 
> people are dealing with this issue...
> 
> While thinking about this problem, I'm having problems understanding the 
> purpose of the HttpMethod.abort() method. It clearly isn't intended for 
> use from separate threads because no synchronization is performed.

It is not supposed to synchronise on any object instance in
HttpMethodBase class as all the magic happens in HttpConnection and
java.net.Socket classes 


>  But 
> if abort() should only be called from the executing thread, I don't see 
> the point - why not just stop processing a request and call 
> releaseConnection() immediately?

No, it should not. It can be called from any thread

Oleg

> 
> Any help would be appreciated.
> 
> Regards,
> 
> Oliver Köll
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message