Search code examples
javatomcat7quartz-schedulerquartz

Quartz Scheduler: how to run a job in only one machine?


I'm trying to setup quartz to execute in 2 machines (sharing the same database). How to setup quartz to run a job (or a set of jobs) in just one machine (another machine cannot pick the job)?


Solution

  • Can you elaborate your question a bit.

    1) If you want both the machines to share the load but want only one instance of the batch to be run at any given time, then you can annotate your job with @DisallowConcurrentExecution

    2) or if you always want only one machine to handle all the load, then why are you using clustered mode? If you are trying to achieve active-stand by model, then you want the machines to co-ordinate outside of quartz which could get tricky.