You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Anders Wallgren <an...@electric-cloud.com> on 2007/01/23 22:48:18 UTC

Intended usage of DefaultConnectingIOReactor in httpcore

I'm having problems putting DefaultConnectingIOReactor to use.  It seems
the intended use it to call connect() from another thread, while
execute() is (basically), sitting on a select() in some other thread.  I
say this because the timeout on the select is quite large and there is
no way to cause DefaultConnectingIOReactor to wakeup the select call,
from what I can see.

 

My experience is that calling register() on the selector while the
selector is in a select() call in another thread makes the call to
register() block for long periods of time.  Usually, the pattern is to
queue up the new connections, then call wakeup() on the selector to have
it configure the outbound connection.  My experience here isn't deep,
and largely through trial and error, so I might be completely wrong on
this.

 

The sample code in NHttpClient makes a few calls to connect() before
calling execute() from the same thread, so this code isn't really a
real-world example, it would seem.  I've poked through the wiki but
haven't found anything relevant to the design of this piece of the code.

 

What am I missing?

 

anders

 

 


RE: Intended usage of DefaultConnectingIOReactor in httpcore

Posted by Anders Wallgren <an...@electric-cloud.com>.
Thanks,

I logged https://issues.apache.org/jira/browse/HTTPCORE-28 and attached
the quick-n-dirty patch I hacked together (is that enough caveats yet?)
to get things working better.  Feel free to use or ignore.

anders

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, January 23, 2007 3:34 PM
To: HttpComponents Project
Subject: Re: Intended usage of DefaultConnectingIOReactor in httpcore

On Tue, 2007-01-23 at 13:48 -0800, Anders Wallgren wrote:
> I'm having problems putting DefaultConnectingIOReactor to use.  It
seems
> the intended use it to call connect() from another thread, while
> execute() is (basically), sitting on a select() in some other thread.
I
> say this because the timeout on the select is quite large and there is
> no way to cause DefaultConnectingIOReactor to wakeup the select call,
> from what I can see.
> 
>  
> 
> My experience is that calling register() on the selector while the
> selector is in a select() call in another thread makes the call to
> register() block for long periods of time.  Usually, the pattern is to
> queue up the new connections, then call wakeup() on the selector to
have
> it configure the outbound connection.  My experience here isn't deep,
> and largely through trial and error, so I might be completely wrong on
> this.
> 

Hi Anders,

The selector in DefaultConnectingIOReactor is used exclusively to select
for OP_CONNECT events, so I felt maintaining a queue for new connections
might not be justified. Apparently I was wrong. Please open a bug in
Jira for this issue and I'll look into it in the coming days.

>  
> 
> The sample code in NHttpClient makes a few calls to connect() before
> calling execute() from the same thread, so this code isn't really a
> real-world example, it would seem.  I've poked through the wiki but
> haven't found anything relevant to the design of this piece of the
code.
> 

This problem has already been reported and fixed in the SVN trunk [1]. I
am currently in the process of reviewing the client-side NIO code, so
please bear with us for a little while, there will be a lot of
improvements (and fixes) coming in ALPHA4

Hope this helps

Oleg

[1] https://issues.apache.org/jira/browse/HTTPCORE-23

>  
> 
> What am I missing?
> 
>  
> 
> anders
> 
>  
> 
> 
> 


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


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


Re: Intended usage of DefaultConnectingIOReactor in httpcore

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-01-23 at 13:48 -0800, Anders Wallgren wrote:
> I'm having problems putting DefaultConnectingIOReactor to use.  It seems
> the intended use it to call connect() from another thread, while
> execute() is (basically), sitting on a select() in some other thread.  I
> say this because the timeout on the select is quite large and there is
> no way to cause DefaultConnectingIOReactor to wakeup the select call,
> from what I can see.
> 
>  
> 
> My experience is that calling register() on the selector while the
> selector is in a select() call in another thread makes the call to
> register() block for long periods of time.  Usually, the pattern is to
> queue up the new connections, then call wakeup() on the selector to have
> it configure the outbound connection.  My experience here isn't deep,
> and largely through trial and error, so I might be completely wrong on
> this.
> 

Hi Anders,

The selector in DefaultConnectingIOReactor is used exclusively to select
for OP_CONNECT events, so I felt maintaining a queue for new connections
might not be justified. Apparently I was wrong. Please open a bug in
Jira for this issue and I'll look into it in the coming days.

>  
> 
> The sample code in NHttpClient makes a few calls to connect() before
> calling execute() from the same thread, so this code isn't really a
> real-world example, it would seem.  I've poked through the wiki but
> haven't found anything relevant to the design of this piece of the code.
> 

This problem has already been reported and fixed in the SVN trunk [1]. I
am currently in the process of reviewing the client-side NIO code, so
please bear with us for a little while, there will be a lot of
improvements (and fixes) coming in ALPHA4

Hope this helps

Oleg

[1] https://issues.apache.org/jira/browse/HTTPCORE-23

>  
> 
> What am I missing?
> 
>  
> 
> anders
> 
>  
> 
> 
> 


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