Return-Path: Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 46984 invoked from network); 26 Aug 2003 20:11:03 -0000 Received: from unknown (HELO outhub1.tibco.com) (63.100.100.155) by daedalus.apache.org with SMTP; 26 Aug 2003 20:11:03 -0000 Received: from unknown(10.106.128.33) by outhub1.tibco.com via csmap id 23066; Tue, 26 Aug 2003 12:29:53 -0700 (PDT) Received: from nsmail1.tibco.com (nsmail1.tibco.com [10.106.128.41]) by na-h-inhub1.tibco.com (8.12.9/8.12.9) with ESMTP id h7QJSkHG022584 for ; Tue, 26 Aug 2003 12:28:46 -0700 (PDT) Received: from tibco.com (remote-10.98.32.33.tibco.com [10.98.32.33]) by mail1.tibco.com (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HK80068XRFYWV@mail1.tibco.com> for commons-httpclient-dev@jakarta.apache.org; Tue, 26 Aug 2003 12:28:46 -0700 (PDT) Date: Tue, 26 Aug 2003 15:28:45 -0400 From: Eric Johnson Subject: Re: [HttpClient] reuse connections In-reply-to: <3F4BCBC9.29835.43FBBC@localhost> To: Commons HttpClient Project Message-id: <3F4BB4ED.4010105@tibco.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 References: <3F4BCBC9.29835.43FBBC@localhost> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Andreas, A "true" response from "isStale()" tends to mean that if HttpClient did go ahead and re-use the connection, the request would fail, usually upon reading the response from the server. This would be unfortunate for you, particularly with regards to "PUT", because then you would not be in any position to know whether the server actually received the entire PUT prior to losing the connection. If I had to guess, what you're seeing is either a simple timing issue, in that some servers simply close a connection after a certain amount of idle time, or that the server to which you're connecting closes a connection after processing a PUT request. In the latter case, ideally the server would be sending back a "Connection: close" header to let HttpClient know that this is what it is doing. You might turn on the wire logging to see if this is the case. HttpClient's particular behavior here stems from Java's inability to detect closed connections prior to JRE 1.4. The only way to determine whether a connection is closed is to actually read or write to the connection, which is exactly what isStale() does. -Eric. Andreas Probst wrote: >Hi all, > >I'd like to reuse open connections in successive calls to the >same instance of HttpClient with everytime newly created >instances of HttpMethod (of course to the same server). > >>From my tests I could see, that successive GETs use the same >connection. A following PUT uses the same connection too. >However, successive PUTs always open a new connection, as the >old one is supposed to be stale. I debugged through the method >isStale() but don't really understand the logic and especially >the behaviour (with InterruptedIOException) behind it. > >Should HttpClient be able to reuse connections in successive >PUTs? What should I do to persuade HttpClient to do so? > >Thanks in advance, >Andreas > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org > > > > >