On 1/28/2012 2:49 AM, Mark Thomas wrote:
On 27/01/2012 22:41, bxqdev wrote:


On 1/28/2012 2:28 AM, Mark Thomas wrote:
On 27/01/2012 22:22, bxqdev wrote:
ok, so what about this case:
http nio  connector + async servlet
i would say that in this variant there're 2 points of asynchronism -
both connector and servlet code are async.
is there a case when i would need such a combination?

Where someone might need that? Sure. Where you would need it? No idea.
My crystal ball is looking rather foggy at the moment. If you have a
specific question about a specific use case...

so can i say that:
1. if one needs to decouple client from nio server (tomcat-7), nio
connector can be used to solve that.

Define "decouple".

make client connection and servlet code execute in different threads. 
asynchronously.


2. async servlet api is not much usefull for servers, with nio
connectors (tomcat-7). at least you can't image the case.

I don't say that. In fact, I said exactly the opposite.

well, then what's the case to use both of this technologies? can you make up a 
theoretical case for an example?


3. async servlet api is some general technology to decouple client from
server, when server doesn't have nio connector (server is bio-only).

No. The Servlet Async API and the considerations for when one might use
it are completely orthogonal to connector selection.

how is that? both connector and servlet process user http request. one by one. 
how are they orthogonal?


I am getting rather bored with this. Please go and read up on blocking
IO vs. non-blocking IO and then read the Async parts of the Servlet 3.0
specification. Then come back here and try asking some more focussed
questions.

i completely understand the difference of bio vs. nio. and i've already read 
async servlet spec.
both technologies decouple (make async) input and output. but i can't imagine 
the case when the one
would need two points of decoupling on one processing chain.

1. bio connector & sync servlet
1.1 i guess everything is obvious

2. bio connector & async servlet
2.1 bio connector receives request and synchronously handles it to async servlet
2.2 async servlet starts async processing code and returns.
2.3 bio connector waits async servlet to finish
2.4 async servlet fullfills response
2.5 bio connector returns servlet to client

3. nio connector & sync servlet
3.1 nio connector makes select and receives http request
3.2 nio connector handles request to sync servlet
3.3 sync servlet processes request and return response
3.4 nio connector makes select and receives http response from sync servlet
3.5 nio connector returns servlet to client

4. nio connector & async servlet
4.1 nio connector makes select and receives http request
4.2 nio connector handles request to async servlet
4.3 async servlet starts async processing code.
4.4 async servlet fullfills response
4.5 nio connector makes select and receives http response from async servlet
4.6 nio connector returns servlet to client

uh, that was a lot of typing :)


Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to