Pankaj Arora wrote:
> Hi,
> I am using a single instance of Http Client. I have implemented using a 
> singleton and each time a method is invoked something like this happens.
> 
> public static HttpClient getClientInstance(){
>            HttpSingletonHolder.connectionManager.closeIdleConnections(20 * 
> 1000);
>            return HttpSingletonHolder.client;
>     }
> 
> Client.executeMethod();
> 
> 
> I was still facing close_Wait problem. So I added 
> public void releaseConnection(HttpConnection conn) {
>  
>        conn.close();
>        super.releaseConnection(conn);
>     }
> 
> in my MultithreadedConnectionManager.
> 
> Strangely still see close_wait on Http. My use cases involves invoking server 
> every one minute in a while loop and problem happens every 14-15 hrs.
> 
> Any suggestions?
> 
> Thanks,
> Pankaj Arora

Pankaj,

As I said, there is no active eviction. That means the idle connection are
closed when and only when you call closeIdleConnections(). You should do this
periodically in a Thread. In pseudo code that is:

new Thread() {
  public void run() {
      while (!Thread.interrupted()) {
        HttpSingletonHolder.connectionManager.closeIdleConnections(20 * 1000);
        Thread.sleep(20*1000);
      }
  }

}.start();

If you are only making one call every minute I don't see why you are using the
MultithreadedConnectionManager at all. Just create a new local HttpClient
instance each time, that's it. There is no point in keeping the instance around
in a singleton if you use it so rarely.

Odi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to