Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TimerTask.cancel() not killing tasks in the webcontainer  RSS feed

Chetan Mishra
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!