Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 35803 invoked from network); 11 Jan 2006 18:05:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Jan 2006 18:05:40 -0000 Received: (qmail 83495 invoked by uid 500); 11 Jan 2006 18:05:39 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 83462 invoked by uid 500); 11 Jan 2006 18:05:38 -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 83407 invoked by uid 99); 11 Jan 2006 18:05:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2006 10:05:38 -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.62] (HELO mail13.bluewin.ch) (195.186.18.62) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2006 10:05:37 -0800 Received: from [192.168.0.3] (83.77.10.123) by mail13.bluewin.ch (Bluewin 7.2.070) id 43BCE390001FC471 for httpclient-user@jakarta.apache.org; Wed, 11 Jan 2006 18:05:16 +0000 Subject: Re: Cancelling HttpMethods From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <43C53872.4080207@newbase.de> References: <43C53872.4080207@newbase.de> Content-Type: text/plain; charset=ISO-8859-1 Date: Wed, 11 Jan 2006 19:03:52 +0100 Message-Id: <1137002632.6391.30.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 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 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