hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Koski <david_ko...@mac.com>
Subject async http clients
Date Thu, 12 Jul 2007 21:10:09 GMT
Hi,

I have been reading NHttpClient and I think I finally understand how  
it all works, but I am a bit stuck with how to use it.  Let's say I  
wanted to build something along the lines of a load balancer:  many  
incoming connections, many outgoing connections, most are idle or  
waiting for a response.

Focusing on the outgoing connections part, I want to have keep-alive  
connections to a set of hosts, multiple connections per port.  For  
example:

	LB -> host1:80
	LB -> host1:80
	LB -> host1:80

	LB -> host2:80
	LB -> host2:80

If I have a queue of operations I want to do, I can see how I might  
use a series of ioReactor.connect() calls to create the connections  
and have submitRequest() methods in my HttpRequestExecutionHandler  
pull them off the queue and service them.

The problem I am having is dealing with the steady state.  I would  
like to keep these connections around for a while (and indeed using  
the DefaultConnectionReuseStrategy they are kept alive.  However, once  
my queue drains and my submitRequest() method returns null, how do I  
wake the handlers back up?  I can see any way to get the reactor to  
call back into my handler without opening a new connection.

Am I missing something?  Or going about this the wrong way?

Thanks,
David Koski

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


Mime
View raw message