• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to disable a quartz job

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my code I have a job running every 15 mins. Now I would like to disable the job. Is there a way to disable the job using corn expression?



I have tried to use the following expression

house.keeping.interval=0 0 1 1 * ? 2010

but got the following error

"Caused by: java.lang.IllegalArgumentException: Range exceeds maximum (8): 2010"

-Thanks and regards
 
Ranch Hand
Posts: 145
8
Mac MySQL Database Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears that the cron expression for @Scheduled annotation consists of second, minute, hour, day of month, month and day of week and thus do not accept the year.

Please check this link for further reference.

As suggested here, a possible option is to implement conditional logic inside your job.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To add to Mike's answer, if the reason you want to control it through annotation is because you have lot on jobs that need to be disabled, you can implement your own aspect that blocks the proceed to the point cut when some condition is true. You can put this annotation on all the jobs that need to be disabled.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic