Java Multithreading Synchronous and asynchronous

Source: Internet
Author: User

Synchronous and asynchronous are commonly used to describe a method call. Once the synchronization method is started, the caller must wait until the method call returns before performing subsequent operations. Once the asynchronous method is called, the method call returns immediately and the caller can perform the subsequent operation. The Async method executes realistically in another thread, and the entire process does not hinder the caller's work. For the caller, the asynchronous invocation seems to be instantaneous. If the asynchronous call needs to return a result, the caller is notified when the asynchronous call is true.

Synchronous and asynchronous method invocations are as follows:

  

Example: I went to the mall to buy an air conditioner. When I fancy a air-conditioner after the salesman orders, shop assistant to the warehouse to take pieces, hot weather makes me urge the merchant hurriedly delivery. So, I waited in the shop, until the merchant sent me and the air-conditioning together to send home, a happy shopping will be over. This is the synchronous call. If I order air conditioning online, then the payment is successful for me the shopping process is over. Merchant orders will be arranged after delivery, and I have nothing to do, as long as the delivery door to sign. This is the asynchronous call.

  

Resources

"Practical Java High concurrency program design" p7-8

Java Multithreading Synchronous and asynchronous

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.