wood burning stoves*
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
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
Similar Threads
Need a program in timer schedule..
Timer task
Callout Handler - receiving delayed events on the same thread
Interval timer
Problem with Timer and TimerTask