hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <adr...@intencha.com>
Subject Re: Questions related to the use of HttpClient classes
Date Thu, 05 Jun 2003 23:18:16 GMT

On Friday, June 6, 2003, at 08:55  AM, Om Narayan wrote:

> My email had a problem with my last post...so here it goes.
> Thanks to Mike and Eric, my questions are mostly answered, and I am 
> now able
> to explain some strange problems that I was seeing. It looks to me that
> using the MultiThreadedHttpConnectionManager as the default is better 
> as it
> is less likely to burn some unsuspecting user.

A couple of other things that may or may not be useful to you:

The HttpClient tutorial - it sounds like you've already got the 
fundamentals sorted out, but it's worth reading this quickly anyway.

And the threading guide:

That'll be good for the archives even if you've found those articles 

> I have another question to add:  How do I "prime" the connections in 
> the
> MultiThreadedHttpConnectionManager pool?  I am running into a problem 
> where
> it is taking a long time (almost 30 secs using https) to open the first
> connection. As a result the session bean that is opening the 
> connection is
> timing out. I need a way to make the first call to create the 
> connection
> work without timing out. Any suggestion is welcome.

I'd say the delay here is actually initialising JSSE rather than 
actually making the first connection.   There should be a way to 
initialise JSSE without actually making a connection.  If not, you may 
find that just doing something like:

try {
	new URL("https://localhost/").openConnection();
} catch (Exception e) {
	// Log this somewhere but generally ignore it as it's expected to fail.

might solve the problem.  You would of course want to ensure that the 
timeout is incredibly short (or just do it from a separate thread).  
That would then make sure that JSSE is properly initialized.  I'm not 
sure about the exact method of creating a HTTPS connection, you might 
need to copy some code from HttpClient.

The other option if you're always connecting to the same host, is to 
either just execute any method to that host, or request a connection 
from the connection manager then immediately release it again.

> Om.

Mike is King of connection managers though so maybe he'll have some 
better ideas.


Adrian Sutton.

View raw message