I saw quite a few posts on how to get rid of CLOSE_WAIT. And based on
those posts I changed my code but still I see CLOSE_WAITS. Below is my
test code:
public class Test {
private static MultiThreadedHttpConnectionManager con = new
MultiThreadedHttpConnectionManager();
private static void doGet(HttpClient client) {
System.out.println("CONN POOL " + con.getConnectionsInPool());
//System.out.println("DEF CON "
+client.getHttpConnectionManager().getParams().getDefaultMaxConnectionsPerHost());
//System.out.println("MAX CON " +
client.getHttpConnectionManager().getParams().getMaxTotalConnections()
);
GetMethod get = new GetMethod("http://localhost:8080/s/e");
get.setQueryString("version=V07.08&request_type=1");
get.addRequestHeader( "Connection", "close");
try {
long statusCode = client.executeMethod(get);
System.out.println(IOUtils.toString(get.getResponseBodyAsStream()));
if (statusCode != HttpStatus.SC_OK) {
}
Thread.sleep(1000);
} catch(IOException ioe){
ioe.printStackTrace();
}catch (Exception e){} finally {
if (get != null) get.releaseConnection();
}
}
public static void main(String []a) throws Exception{
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(2);
//params.setMaxConnectionsPerHost(2);
params.setMaxTotalConnections(2);
con.setParams(params);
HttpClient client = new HttpClient();
client.getParams().setParameter("http.connection.timeout", new
Integer(1000));
int i = 0;
while ( i++ < 500){
client = new HttpClient(con);
doGet(client);
client = null;
con.closeIdleConnections(1000l);
//con.deleteClosedConnections();
}
/////////////
so I am closing connection after each call, but still I see lot of
CLOSE_WAIT. Is there something that I am doing incorrectly? I was
expecting that above code will get rid of CLOSE_WAIT
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]