On Thu, 2008-05-15 at 20:27 -0700, Sujith Joseph wrote: > Hi Oleg, > Thanks for your reply. I really appreciate your help. I have > couple of more questions on this. > > I am currently using httpclient 3.0 library. > SimpleConnectionManager.shutdown () method is not available in 3.0 libs. if > I am continuing to use these libraries in my application, can I use > httpClient.getConnectionManager(). closeIdleConnections(1) to close of > connections?. >
Yes, you can. #closeIdleConnections(0) should be even better > Would setting small values like 1 millisecond for idle connection timeout be > an overhead to the JVM and impact performance? I do not think so. > Would this act as a replacement for SimpleConnectionManager.shutdown()? > Partially. At the very least it would leave no idle connection open, which should result in closure of all open sockets. > Based on your reply, I assume that you recommend re-using the same > httpClient instance for all http requests, instead of creating httpClient > instances for each http requests, even if we are not using > MultiThreadedConnectionManager. Is it because, that the latter approach has > an overhead of creating/closing more connections and no re-use of > connections and thereby giving less throughput?. > Yes, it is. Just make sure to not execute requests from multiple threads without synchronization. > > Are you aware of any issues in using HttpClient 3.1 libraries in Websphere > Application Server (WAS) 5.1. ? I have not tried this yet. But if you > already know this, I think, I could save some testing time . > No, I am not. However, I have been lucky enough to have not touched WAS for 4 years. Oleg > > Thanks, > Sujith > > > On Thu, May 15, 2008 at 12:10 PM, Oleg Kalnichevski <[EMAIL PROTECTED]> > wrote: > > > On Tue, 2008-05-13 at 17:36 -0700, Sujith Joseph wrote: > > > Hi, > > > I would like to know whether it is necessary to invoke > > > httpClient.getConnectionManager(). closeIdleConnections(1000), after > > > creating > > > an httpClient (httpClient = new HttpClient()), creating an httpmethod, > > > executing the httpmethod and performing method.releaseConnection(), to > > > ensure that the http connections are properly closed, since I am creating > > an > > > httpClient instance for each and every http request (since I am not using > > > MultiThreadedConnectionManager). > > > > That basically means you are telling HttpClient to close connections > > that have been idle for 1000 ms. I am not sure that is what you want. > > > > > > > > If I am creating a httpClient instance (without using > > > MutliThreadedConnectionManager), Does a SimpleHttpConnectionManager gets > > > created for each httpClient creation behind the scenes. > > > > > > > Yes, it does. > > > > > Can I perform a type cast like this > > > ((SimpleHttpConnectionManager)httpClient.getConnectionManager).shutdown() > > to > > > ensure complete release of connections. > > > > > > > Yes, you can. Moreover, you really should. > > > > > If I am not using the httpClient instance anymore after executing a http > > > method request, do you recommend closing off idle connections / shut down > > > ConnectionManager, to avoid creation of too many open sockets in > > CLOSE_WAIT > > > state. > > > > > > > You _should_ shut down the connection manager if you no longer need it > > and want to ensure it releases all resources it currently holds > > > > > Can I re-use the same httpClient instance to perform http method > > executions, > > > if I am not using a multi-threaded Connection Manager? > > > > > > > Absolutely. > > > > Oleg > > > > > > > > Thanks, > > > Sujith > > > > > > --------------------------------------------------------------------- > > 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]