Hi, It looks like there is some confusion. I am doing HttpClient client = getClientInstance(); Client.exceuteMethod()l So each time getClientInsatnce is called closeIdleconnections(20*1000) will be called. Also request evry 1 minute is one use case I am facing problem with. I have many more use cases.
Last, I think closeIdleConnections don't close the idle Connections which are not registered with Idle Connection Handler. I thought calling multithreadedconnectionmanger.closeidleConnections(20 * 1000) will close all the idle connections which were idle for more than 2-0 sec. but looks like you have to register connection with idleConnectionhandler for it to be closed. Am I right? Thanks, Pankaj Arora -----Original Message----- From: Ortwin Glück [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 14, 2007 2:17 PM To: HttpComponents Project Subject: Re: Close_Wait problem 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
