Oliver Köll wrote:
Hi Oleg,

thanks for your reply. See inline...

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.


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


I was testing a case where HttpClient was trying to connect to an unreachable host and abort() didn't have any effect. OTH, even Firefox goes into a limbo in such cases, so I guess I bear with that...


Oliver,
This is a known problem. For a detailed explanation see

http://issues.apache.org/bugzilla/show_bug.cgi?id=35383

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


Hmm, shouldn't at least HttpMethodBase.aborted and HttpMethodBase.responseConnection be synchronized, because these attributes can obviously be accessed from different threads when using abort()? Also, I don't see any synchronization in HttpConnection either.


The synchronization of access to individual connections is achieved by using a threading-safe connection manager. The HttpConnection class as such is not threading-safe. However, the HttpConnection#close() method should be safe to call from any thread. If you see any specific problems in it that may lead to a race condition, please feel free to file a bug report.

Oleg

Oliver


---------------------------------------------------------------------
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]

Reply via email to