Concurrent Report exception in Forkjoin subtasks

Source: Internet
Author: User

Submit the task to the forkjoin thread pool, the main thread calls the Get method waits for the child thread execution task, once the exception is thrown in a forkjoin child thread, And the child thread does not catch the exception, what happens to the main thread.

Much of the previous concern was that the Get method would throw timeoutexception, and that the Get method might actually throw interruptedexception and Executionexception, so what happens when these two exceptions are thrown?

When to throw interruptedexception.
Assuming that there are two threads T1 and T2, the T2 is created in the T1 thread, the T2 's Get method is called in the forkjointask thread, T1 T2 is invoked in the interrupt thread, and T2 is thrown interruptedexception exception.

When will the executionexception exception be thrown?
If an exception is thrown during a subtask that executes forkjoin , and the exception is not catch in a child thread, then the new Executionexception (ex) is passed in the Get method To wrap the exception in a executionexception type of exception.

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.