Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 53504 invoked from network); 12 Jan 2006 17:54:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Jan 2006 17:54:03 -0000 Received: (qmail 11329 invoked by uid 500); 12 Jan 2006 17:53:49 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 11286 invoked by uid 500); 12 Jan 2006 17:53:49 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 11255 invoked by uid 99); 12 Jan 2006 17:53:49 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jan 2006 09:53:49 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [195.186.18.63] (HELO mail15.bluewin.ch) (195.186.18.63) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jan 2006 09:53:46 -0800 Received: from [192.168.0.2] (213.3.62.17) by mail15.bluewin.ch (Bluewin 7.2.070) id 43C618D30002D9CF for httpclient-user@jakarta.apache.org; Thu, 12 Jan 2006 17:53:25 +0000 Message-ID: <43C69796.3010803@apache.org> Date: Thu, 12 Jan 2006 18:53:26 +0100 From: Oleg Kalnichevski User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: HttpClient User Discussion Subject: Re: Cancelling HttpMethods References: <43C53872.4080207@newbase.de> <1137002632.6391.30.camel@localhost> <43C6718B.1020908@newbase.de> In-Reply-To: <43C6718B.1020908@newbase.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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: 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