This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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.
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!