...
Similarly, tasks that use some mechanism other than Thread.interrupted()
to determine when to shut down will be unresponsive to shutdown()
or shutdownNow()
. For instance, tasks that check a volatile flag to determine whether it is safe to shutdown will be unresponsive to these methods. The guideline rule THI05-J. Do not use Thread.stop() to terminate threads provides more information on using a flag to terminate threads.
...
TPS02-EX1: Short-running tasks that execute without blocking are not required to adhere to this guidelinerule.
Risk Assessment
Submitting tasks that are not interruptible may preclude the thread pool from shutting down and cause denial of service.
...
Search for vulnerabilities resulting from the violation of this guideline rule on the CERT website.
Bibliography
...