When I read the source code of java.util.Timer
, I found that java.util.Timer
is implemented by a TimerThread
and a TaskQueue
It is said that java.util.Timer
can be cancelled by java.util.Timer.cancel()
,
But when I call java.util.Timer.cancel()
I found TimerThread in Timer still running ,
Does this a problem for online system ?
And if possible , how can I stop TimerThread
inside java.util.Timer
?
From source of TimerThread
(jdk 7) I finally found that Timer.cancel()
do works.
TimerThread wait TaskQueue
, when Timer.cancel()
called , TaskQueue
notify TimerThread
, And TimerThead should finally exit if `TaskQueue is EMPTY...
Thank you for your comment , sorry to wasting your time.