hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Hicks" <jehi...@novell.com>
Subject Re: Force-close connections queston
Date Tue, 27 Jun 2006 15:11:13 GMT
Thanks, Oleg. That's just what I was looking for!
 
Jeremy Hicks
Novell, Inc., the leading provider of information solutions
http://www.novell.com 

>>> Oleg Kalnichevski <olegk@apache.org> 6/27/2006 9:09 AM >>>
On Tue, 2006-06-27 at 09:02 -0600, Jeremy Hicks wrote:
> My reason for wanting to join was to thank all of you for a great
> library and to ask if anybody has code available to do exactly what
the
> docs suggest in this section of the user guide:
>  
>
http://jakarta.apache.org/commons/httpclient/performance.html#Connection_persistence

> 
>  
> "The easiest way to disable connection persistence is to provide or
> extend a connection manager that force-closes connections upon
release
> in the releaseConnection (
>
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#releaseConnection(org.apache.commons.httpclient.HttpConnection)
> ) method."
>  
> I would like to be able to force connections to not be persistent
while
> still using the multi-threaded http connection manager. If there is
code
> already available, that would be great. I think that just changing
the
> current multi-threaded http connection manager might be trivial, but
I'm
> not exactly sure what code to add to force the connections to close.
>  
>
http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java?view=markup

> 

Jeremy,
This will do the trick

public class MyHttpConnectionManager extends
MultiThreadedHttpConnectionManager {

    public void releaseConnection(final HttpConnection conn) {
        if (conn == null) {
            return;
        }
        conn.close();
        super.releaseConnection(conn);
    }
    
}

Oleg

>  
> Thanks
>  
> 
> Jeremy Hicks
> Novell, Inc., the leading provider of information solutions
> http://www.novell.com ( http://www.novell.com/ ) 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message