Please enable JavaScript.
Coggle requires JavaScript to display documents.
7.1 Task Cancellation - Coggle Diagram
7.1 Task Cancellation
- Interruption (Preferred Mechanism)
Thread interruption is cooperative, not forceful
-
Blocking methods (e.g., sleep, wait) throw InterruptedException
-
-
-
User request (e.g., pressing a cancel button, JMX interface)
Time limits (e.g., search stops when time expires)
Application events (e.g., one task finds a solution, others are cancelled)
Errors (e.g., disk full — cancel other tasks)
-
-
-
-
- Responding to Interruption
-
-
-
-
- Custom Cancellation with newTaskFor
-
-
Customize:
-
Add logging, stats, or non-standard cancellation logic
-
- Non-interruptible Blocking
-