Created
July 14, 2014 08:39
-
-
Save yanhua365/c3e93774ae7a37425bca to your computer and use it in GitHub Desktop.
解释Servlet3.0中的异步功能的处理过程
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Once your doGet method ends, the response is complete and sent back to the client. Your thread may or may not still be running, but it can't change the response any longer. | |
What the new async feature in Servlet 3.0 does, is that it allows you to free the request thread for processing another request. What happens is the following: | |
RequestThread: |-- doGet() { startAsync() } // Thread free to do something else | |
WorkerThread: |-- do heavy processing --| | |
OtherThread: |-- send response --| | |
The important thing is that once RequestThread has started asynchronous processing via a call to startAsync(...), it is free to do something else. It can accept new requests, for example. This improves throughput. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/3810448/servlet-3-0-asynchronous