wood burning stoves 2.0
The moose likes Threads and Synchronization and the fly likes Killing current TimerTask Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Killing current TimerTask" Watch "Killing current TimerTask" New topic

Killing current TimerTask

Victor Subick

Joined: Aug 07, 2003
Posts: 1
Is there an elegant & easy way to kill a current(executing) TimerTask if a certain time has elapsed (Say 2 minutes). This situation can occur if my TimerTask is blocked on IO.
My code implements a TimeMonitor class and listener interface. Based on code from JavaWorld tips 125. http://www.javaworld.com/javaworld/javatips/jw-javatip125.html
I am trying to stop the current executing TimerTask thread if a certain time has elapsed.
Here is the code.


Calling class with main method: Test.java

[ August 07, 2003: Message edited by: Victor Subick ]
I agree. Here's the link: http://aspose.com/file-tools
subject: Killing current TimerTask
It's not a secret anymore!