2

I have used cron4j to start a task to email people daily on certain conditions (they haven't done their job) using Stripes ActionBean.

I saved the task id in MySQL.

However, I cannot seem to stop it. I tried using the id to deschedule the task, but it doesn't work. I was only able to stop it by making sure the condition is always false.

How can I stop the task using a different Scheduler instance (cause it's using servlets and actionbeans, and I cannot persist the scheduler instance in the database)? Is it even doable?

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
Aladdin Teng
  • 330
  • 1
  • 2
  • 13

1 Answers1

0

I know this is quite an old post, sorry, just started looking at cron4j recently.

Most likely you are not getting the same instance of the Scheduler. The Scheduler has a getGUID method, message that out when you instantiate it and then again when you attempt to deschedule. If they're not the same, that's the problem.

I am implementing cron4j on a web site right now and have decided to use a Singleton pattern to ensure that any time I ask for the Scheduler I am getting the one and only instance loaded. So far I can deschedule without problem.

John Kuhns
  • 506
  • 4
  • 20