File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 18544
    
  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)
 
 
subject: TimerTask cancel()
 
Similar Threads
TimerTask.cancel() not killing tasks in the webcontainer
Help needed with java.util.Timer
stopping Timer after certain number of actions
Timer IllegalStateException
Question about Unreferenced