aspose file tools*
The moose likes Threads and Synchronization and the fly likes TimerTask.cancel() not killing tasks in the webcontainer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "TimerTask.cancel() not killing tasks in the webcontainer" Watch "TimerTask.cancel() not killing tasks in the webcontainer" New topic
Author

TimerTask.cancel() not killing tasks in the webcontainer

Chetan Mishra
Greenhorn

Joined: Sep 09, 2003
Posts: 8
Hi,

I have a java programme which creates timer tasks and runs 5 tasks[scheduled to run continueously]. I have this deployed as a web module in an appliction, deployed in WAS 5.1.

These tasks are to be started automatically when the application is started and should be killed when the application is brought down [And not the application server]. So, invoking this in init() of statup servlet and killing in destroy() of the servlet by calling cancel() of TimerTask class.

But this cancel() doesn't seems to work here [inside the web container]. When the same programme executed out side container [as a standalone application], cancel() actually kills the taks.

Points to be noted here is i cannot put this cancel() inside the run() of each task. So will have to call on the instance of the TimerTask object.

Can any one let me know what could be the issue.
How can i kill all these timer tasks inside the webcontainer.

Thanks & Regards,
Chetan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimerTask.cancel() not killing tasks in the webcontainer
 
Similar Threads
questions java.util.Timer
TimerTask, Threads and Servlets
Thread Scheduler
How to Start a service automatically when the tomcat starts?
How to stop a Timer after it's run more than once?