I am using quartz + spring for scheduling. If I want to store some static data in memory and use it for every iteration of the job, how can that be possible.
Thanks
I am using quartz + spring for scheduling. If I want to store some static data in memory and use it for every iteration of the job, how can that be possible.
Thanks
I will assume that you are using Quartz 1.8. Quartz 2.x offers annotations that make the implementation a bit more convenient but once you have the code for 1.8, it is not hard to replace it with those annotations.
StateFulJob
interface. If you use Quartz 2.x, implement the Job
interface instead and annotate your class with @PersistJobDataAfterExecution
.JobDataMap
with context.getJobDetail().getJobDataMap()
.Make sure that all objects you put into the JobDataMap
are serializable. Also configure Quartz not to run the job concurrently to prevent a race condition.