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: [email protected] For additional commands, e-mail: [email protected]
