File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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.
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:

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