hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stojce Dimski <sdmi...@yahoo.it>
Subject Re: SessionRequest, SessionRequestCallback and other nio stuff...
Date Wed, 07 Feb 2007 00:35:54 GMT
Hi Oleg,

Sorry for the late response but only now I have red your messages...

1) I think that would be more wise to wait for 'requestReeceived' event
because some client can not complete whole request, and I would initiate
outgoing connection before complete request was loaded ?

2) Is it possible that I don't even receive 'inputReady' event if the
request is not 'enclosing entity' ?

I gave a look at your 'ThrottlingHttpServiceHandler' in attempt to use
it as an example for my server part, and looking at the code I have a
few puzzles:

a) in a 'requestReceived' method when receiving
HttpEntityEnclosingRequest you check if 'expectContinue' send a 'ack'
response, but what happens if client don't 'expectContinue' ? Code goes
on and asynchronously process the request trough 'executor.execute', but
what happens if we have a big request which doesn't support
expectContinue, wouldn't this method be followed by a series of
'inputReady' calls ? How can we know that whole request is received and
we can process it ? I think that the same problem is present also with
some NHttpClientHandler ?

b) if I execute 'processRequest' asynchronously trough a executor and
inside processRequest I invoke reactor.connect which gives me
SessionRequest, invoking 'waitFor' would suspend this thread until
SessionRequest is processed, but other threads and server and client
side io threads would run undisturbed ? Do you think it is the correct
approach ?

Thanks,
Stojce


Oleg Kalnichevski wrote:
> (1) First off, one important thing to understand about NIO is that the
> application does not have to react to I/O events if it is unable to
> process them. So, after having received an incoming connection you
> should initiate a request for an outgoing connection, update the HTTP
> context accordingly and move on without blocking the I/O thread
>
> (2) If you start receiving 'input ready' events while the outgoing
> connection is still being open, you should suspend 'input ready' events
> by calling #suspendInput() on the incoming connection.
>
> (3) Once you receive a 'connection open' event for the outgoing
> connection, re-enable 'input ready' events by calling #enableInput() on
> the incoming connection.

---------------------------------------------------------------------
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