aspose file tools*
The moose likes Java in General and the fly likes TimerTask cancel() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "TimerTask cancel()" Watch "TimerTask cancel()" New topic
Author

TimerTask cancel()

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
TimerTask has a cancel() method. If I have a repeated run schedule, this call forces the next scheduled run not to happen. But does it kill the thread ?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18747
    
  40

Originally posted by Raj Ohadi:
TimerTask has a cancel() method. If I have a repeated run schedule, this call forces the next scheduled run not to happen. But does it kill the thread ?


No, it does not kill the thread. If you want to do that, you need to call the cancel() method of the Timer itself.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: TimerTask cancel()