hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Gl├╝ck <...@odi.ch>
Subject Re: FW: HttpClient authentication problem.
Date Fri, 18 May 2007 10:02:14 GMT

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 

          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.");

This connection manager can be completely stateless and thus unsynchronized.


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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org

View raw message