File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Killing current TimerTask

Victor Subick
Greenhorn

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.
TimeMonitorListener.java

TimeMonitor.java

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