The core idea of Java future model

Source: Internet
Author: User

The core of the future model is the removal of the wait time for the main function and the time period that would otherwise have to wait for processing other business logic (according to Java Program Performance optimization).

The future mode is somewhat similar to a commodity order. When you shop online, after you submit your order, you don't have to wait at home at the time of receipt to do something else. When it comes to programming, when a request is submitted, it is expected to get a reply if the reply is likely to be slow. The traditional time waits until this reply receives the time to do other things, but if uses the future design pattern to wait for the reply arrival, waits for the reply the process to be possible to do other things.

For example, the following request calls the process sequence diagram. When a call request is made, it takes a long time to return. The diagram on the left needs to wait until the data is returned before other operations can be resumed, while the client on the right side of the future pattern does not have to wait for other things to do. When a server segment receives a request and returns the result to the client immediately, the result is not a real result (a virtual result), that is, a false data is obtained first, and then other operations are performed.

Java Future Mode core idea (turn)

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: info-contact@alibabacloud.com 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.