Okay, this didn't seem to do the trick for what I'm attempting to do.
I'll explain.
 
We have written a client that logs into a web application and then gets
redirected to a web resource. We want to use SSL during this process.
Everything seems to be working fine, but we noticed that abbreviated
handshakes are being done instead of a full handshake. 
 
We tested using LoadRunner and it shows full handshakes being done. I
assumed this discrepancy was due to the fact that we are using the
MultiThreadedHttpConnectionManager which will reuse connections when
multiple requests go to the same destination. (Please correct me if this
is incorrect.)
 
This was why I requested information as to how to force-close the
connections. This was so that the connections wouldn't get reused and a
new connection would have to be made the next time a client requested a
page at the same destination.
 
I have added the code Oleg gave me and changed the reference in our
code from MultiThreadedHttpConnectionManager to MyHttpConnectionManager.
The client still appears to be doing abbreviated SSL handshakes and I'm
puzzled as to why. Is there something that SSL throws into the mix that
would change the result here?
 
The user guide threading page says, 
 
"One main side effect of connection management is that connections must
be manually released when no longer used. ... The application therefore
must manually release the connection by calling releaseConnection() on
the method after the response body has been read."
 
MultiThreadedHttpConnectionManager connectionManager = new
MultiThreadedHttpConnectionManager(); HttpClient client = new
HttpClient(connectionManager); ... // and then from inside some thread
executing a method GetMethod get = new
GetMethod("http://jakarta.apache.org/";); try {
client.executeMethod(get); // print response to stdout
System.out.println(get.getResponseBodyAsStream()); } finally { // be
sure the connection is released back to the connection // manager
get.releaseConnection(); }
 
So, I guess what I'm confused about is, how does implementing your own
releaseConnection() function in another ConnectionManager class (which
force-closes connections) cause the connections to close, if you have to
manually call the releaseConnection() function associated with an
HttpMethod instance (GetMethod, etc).
 
>From what I can tell, GetMethod (as an example) ultimately inherits
releaseConnection() from the HttpMethodBase class. I assumed that the
HttpMethodBase class actually implements this method as I can't tell
from the JavaDocs that it inherits or implements this method from
another class. I don't see the complete connection between the
releaseConnection() of the custom ConnectionManger class and that of the
GetMethod class.
 
Sorry if that was long-winded. If I can clarify any points here, please
let me know.

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

>>> Oleg Kalnichevski <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to