You're not really running out of file handles. You're running out of sockets. If you don't make sure you destroy the HttpClient object after each use, then you're leaving a socket open for each HttpClient object you allocate. This may even be worse if you use a multithreaded connection manager (and a pool of sockets.) releaseConnection() does not close the socket. It releases it back to HttpClient for reuse.
For a solution, use a single HttpClient. --Steve -----Original Message----- From: Lowell Kirsh [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 1:53 PM To: [email protected] Subject: Running out of file handles Ok, I've read some of the archives and see that other people are having the same problem as I am, where they end up with a ton of sockets in the CLOSE_WAIT state. What I would like to learn is not how to solve that problem in general, but how to solve it in my specific case. What I'm trying to do is create a WebServiceCall class. The way I've done it so far, which is not working out, is for each instance to represent a single call to a web service, and not be reusable. Each instance has its own HttpClient instance, which I know is wasteful, but I am not concerned with being overly efficient in this case. So how it works is like this: create a WebServiceCall, which creates a new HttpClient object. Then call WebServiceCall.execute() which calls something like _httpClient.execute(new GetMethod(_url)) and then calls releaseConnection() on the GetMethod object. That's it. So how should I configure or use the HttpClient objects so that I won't run out of file handles? thanks Lowell --------------------------------------------------------------------- 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]
