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: Aborting requests via Thread.interrupt()?
Date Sun, 16 May 2010 09:05:12 GMT
On Sat, 2010-05-15 at 18:56 +0200, Mario Winterer wrote:
> Hi!
> 
> Is it possible to abort an ongoing HTTP request by calling
> Thread.interrupt() on the thread currently
> executing HttpClient.execute(...)?
> The tutorial only mentions HttpUriRequest.abort(), which is nice but
> proprietary (code that does not have access to the request object is not
> able to abort it - this may happen if the request is executed behind some
> [blocking] API).
> 
> Thanks,
>   Mario

Mario,

The trouble is Thread#interrupt() does not reliably interrupt blocking
I/O operations. The only truly reliable way to interrupt an I/O
operation is by shutting down the socket, which is what
HttpUriRequest#abort() does.

Oleg 



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


Mime
View raw message