Java EE documentation 327 page Two snippet code summary

Source: Internet
Author: User

The first code is not an asynchronous process, the service program receives a parameter from the request, and then takes the information based on the parameter from the database or the Web page, then these resources are slow, causing the blocking operation, the service program uses the results obtained from the resource to cause the response.

The second code is an asynchronous process, and Request.startasync () causes the request to be in an asynchronous process through Acontext.start (new Runnable () {...}) Enter a new line, use the inner class run () to execute the new line, the inner class has the read request parameters and the entry of the asynchronous environment to write the response, and then use complete () to send the response to the client.

Java EE documentation 327 page Two snippet code summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.