Pankaj,
When always closing the connections it makes no sense to pool them. The
MultithreadedConnectionManager is an overkill base class for this case,
as it tries to do the exact oposite. Rather start a conn mgr from
scratch. Look at the SimpleHttpConnectionManager for sample code.
getConnectionWithTimeout can just create a new connection every time.
public HttpConnection getConnectionWithTimeout(
HostConfiguration hostConfiguration, long timeout) {
HttpConnection httpConnection = new
HttpConnection(hostConfiguration);
httpConnection.setHttpConnectionManager(this);
httpConnection.getParams().setDefaults(this.params);
return httpConnection;
}
and releaseConnection() can just close it:
public void releaseConnection(HttpConnection conn) {
if (conn != httpConnection) {
throw new IllegalStateException("Unexpected release of an
unknown connection.");
}
httpConnection.close();
}
This connection manager can be completely stateless and thus unsynchronized.
Ortwin
Pankaj Arora wrote:
But how to close connection while they are returned to pool.
I completely missed this part. What to overload here?
May be something like this ::
Void releaseConnection(httpConnection connection){
connection.close();
super.releaseConnection();
}
Right?
Thanks,
Pankaj Arora
--
[web] http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp] key 0x81CF3416
finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]