Search code examples
javaspringquartz-scheduler

Quartz scheduler - Is it possible to configure Quartz to allow jobs with the same identification in RAMJobStore?


I'm using Quartz together with Spring. The JobStore that I'm using is the RAMJobStore.

I create a couple of jobs with the same identification (they have the same instance definition (JobDetail)). Because I want to make sure that these jobs aren't executed in parallel, I annotated their job class with @DisallowConcurrentExecution.

My problem is that the RAMJobStore doesn't allow more than one job with the same identification in the same time in the store, so when I try to add the job I get the exception:

   org.quartz.ObjectAlreadyExistsException: Unable to store Job : 
   'jobX', because one already exists with this identification.

Do you have any idea about how I can overcome this problem?

Thanks a lot!


Solution

  • It is clear from the RAMJobStore source code that there can't be two jobs with the same key in the same time in the RAMJobStore.

    Have a look here at the source code.