Java Non-Blocking HTTP Server

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2011-11-12T17:40:58Z Indexed on 2011/11/12 17:50 UTC
Read the original article Hit count: 256

Filed under:
|
|
|

I have written an application using embedded Jetty that makes network calls to other services.

I presume that the serving threads are idle whilst waiting for the network calls to complete.

Is there any way to have a worker thread that switches between requests to perform work that can be done at the current time and then when the network calls return also handle that? A request would be returned when all work has been completed for it.

I know this is a common paradigm, and I have used it for non-blocking TCP networking, but I'm unsure as to how to achieve this on a Java HTTP server whilst also waiting on external results.

Any links or explanations are appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading