Structuring Concurrent Applications

Chapter 7 :Cancellation and Shutdown

It is easy to start tasks and threads,But Getting tasks and threads to stop safely, quickly, and reliably is not always easy because it could leave shared data structures in an inconsistent state.
Important generic point to Note: Regarding Stopping a thread
Java does not provide any mechanism for safely forcing a thread to stop
what it is doing.1 Instead, it provides interruption, a cooperative mechanism that
lets one thread ask another to stop what it is doing.

DEALING well with failure, shutdown, and cancellation is one of the CHARACTERISTICS
That DISTINGUISHES a WELL-BEHAVED APPLICATION from one that merely WORKS.

Following section addresses mechanisms for CANCELLATION and INTERRUPTION, and
how to CODE tasks and services to be RESPONSIVE to cancellation REQUEST.

Task Cancellation:
A task that wants to be cancellable must have a CANCELLATION POLICY.


Published by

Unknown's avatar

sevanand yadav

software engineer working as web developer having specialization in spring MVC with mysql,hibernate

Leave a comment