Menu

#6 Handle Thread.interrupt() properly to actually terminate

General
open
nobody
5
2003-08-05
2003-08-05
No

ThreadPool should implements a interrupt() to forward
interrupt() calls on threads, instead of deprecated stop().

Associated runnables, (and any code actually, never
seen soo many unhandled interrupt exception...) should
never ignore the interrupted exception.

The interrupted code should ALWAYS verify if it know
the reason of the interrupt with some state variable
set by the requester. If it does know, it may handle it
and continue. If not (exception comes from outside the
class knowledge), it HAS TO return from its code
propagating the interrupted exception.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.