Hi
We are calling IdleConnectionTimeoutThread() method to close the idle
connections. But this looks like it not calling as we expected.
We have set the setTimeoutInterval as 5000. We are creating client object for
each request.
Do we need to implement Connection Manager and maintain connection pool and get
the Connection Manager to close the Idle connections?
Can we call IdleConnectionTimeoutThread for each request like this?
My Client code looks like following
==============================================
public String connect (String reqMsg) throws Exception {
PostMethod method = new PostMethod(url.toExternalForm());
HttpClient client = new HttpClient();
IdleConnectionTimeoutThread ict = new IdleConnectionTimeoutThread();
ict.addConnectionManager(client.getHttpConnectionManager());
ict.setConnectionTimeout(5000);
ict.start();
try {
method.setRequestBody(reqMsg);
int statusCode = client.executeMethod(method);
results = method.getResponseBodyAsString();
}
catch(ConnectException cex){
System.out.println("Exception "+cex);
}catch(Exception e){
System.out.println("Exception occured "+e);
}finally{
method.releaseConnection();
}
}
----------------------------------------
Thanks
Teja
Send instant messages to your online friends http://uk.messenger.yahoo.com