Skip to Content
Java Concurrency in Practice
book

Java Concurrency in Practice

by Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea
May 2006
Intermediate to advanced
432 pages
12h 21m
English
Addison-Wesley Professional
Content preview from Java Concurrency in Practice

Chapter 7. Cancellation and Shutdown

It is easy to start tasks and threads. Most of the time we allow them to decide when to stop by letting them run to completion. Sometimes, however, we want to stop tasks or threads earlier than they would on their own, perhaps because the user cancelled an operation or the application needs to shut down quickly.

Getting tasks and threads to stop safely, quickly, and reliably is not always easy. 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.

[1] The deprecated Thread.stop and suspend methods were an attempt to provide such a mechanism, but were quickly ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Concurrency and Multithreading in Practice

Java Concurrency and Multithreading in Practice

Tatiana Fesenko
Modern Concurrency in Java

Modern Concurrency in Java

A N M Bazlur Rahman
Java Concurrency, 2/e

Java Concurrency, 2/e

Douglas Schmidt
Modern Java in Action

Modern Java in Action

Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft

Publisher Resources

ISBN: 0321349601Purchase book