hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Teja Sai Krishna <saravit...@yahoo.com>
Subject Re: CLOSE_WAIT state at the client side
Date Mon, 17 Oct 2005 17:13:36 GMT
Hi Oleg,
 
Thanks for your reply.
 
is method.releaseConnection() will not close these connections?. I thought releaseConnection
will take care of releasing the CLOSE_WAIT connections. method.releaseConnection() method
will not close the connections completely?.
 
We are using default connection manager and not using any multithreadedConnection manager.

 
Do we need to implement multi threade connection manager to close these idle connections?
 
My code looks like this.
---------------------

 PostMethod method = new PostMethod(url.toExternalForm());
        DefaultMethodRetryHandler retryHandler = new DefaultMethodRetryHandler();
        retryHandler.setRetryCount(0);
        method.setMethodRetryHandler(retryHandler);
        HttpClient client = new HttpClient();
        client.setTimeout(rtimeout);
     try {
      method.setRequestBody(psRequestMsg);
            int statusCode = client.executeMethod(method);
            results = method.getResponseBodyAsString();
        }
     catch(ConnectException cex){
     
     }catch(Exception e){
     
     }finally{
      method.releaseConnection();
       }
 
---------------------
 
Thanks
Teja

Oleg Kalnichevski <olegk@apache.org> wrote:
On Mon, Oct 17, 2005 at 04:48:04PM +0100, Teja Sai Krishna wrote:
> Hi,
> 
> We have HTTP Client application that connects to the HttpListening Connector, which runs
on weblogic 8.1. I have observed some strange behaviour at my client side connection states.
Once the communication is over, some client side connections are in CLOSE_WAIT state. Some
times I have seen these CLOSE_WAIT connections will disappear after one day. But most of the
times it will not disappear even after one day. I have to kill my application. 
> 
> Is CLOSE_WAIT at the client side means, my client is waiting for final acknowledgement
from the server?
> 

Not really. That means these connections have been closed by the server
but the client still assumes they are valid and keeps them in the
connection pool. The way to go is to implement a custom idle connection
handler:

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionHandler.html

Hope this helps

Oleg




> Thanks
> Teja
> 
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Send instant messages to your online friends http://uk.messenger.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message