|
[
Permlink
| « Hide
]
Philip May added a comment - 11/Oct/07 03:43 AM
Even the ContextLoaderListener is using ThreadGroup.stop().
Indeed Thread.stop should not be used but in practice, I've found no other way to stop 'rogue' threads. Consider the case where the thread instead of looking at a flag just keeps on waiting or working - there is nothing we can do to interrupt that particular thread for doing its work especially when catching exceptions.
Both runnableTimedExecution and especially ContextLL deal with app starts/stops where the platform can shutdown while some contexts are initializing and in that case, we have to make sure everything goes down. We actually have an excellent test made by Hal where the platform shuts down while an appCtx is started and w/o using thread.stop, things just keep hanging. But isn't the code using thread.stop() regardless? Seems like it should first see if it exits gracefully? Or maybe I am missing something.
thread.stop is called only if waitForZero does not exist succesfully -i.e. task.run takes longer then expected in which case, the thread is stopped and true returned.
If the task.run ends faster then the time period, then false is returned w/o interacting with the thread. |
||||||||||||||||||||||||||||||||||||||||||||||