...
Similarly, when trying to cancel individual tasks within the thread pool using the Future.cancel()
method, ensure that the task supports interruption. If it does, pass a boolean
argument true
to cancel()
, otherwise pass false
. The value false
indicates that the task will be canceled if it has not already started.
Exceptions
EX1: Tasks that execute quickly and do not block may violate this guideline.
Risk Assessment
Submitting tasks that are not interruptible may preclude the shut down procedure of a thread pool and cause denial of service.
...