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
我假设您使用的是 Quartz 1.8。Quartz 2.x 提供了注释,使实现更加方便,但是一旦你有了 1.8 的代码,用这些注释替换它就不难了。
StateFulJob
接口。如果您使用 Quartz 2.x,请Job
改为实现接口并使用@PersistJobDataAfterExecution
.JobDataMap
with context.getJobDetail().getJobDataMap()
。确保您放入的所有对象JobDataMap
都是可序列化的。还要将 Quartz 配置为不同时运行作业以防止出现竞争条件。