更新现有的JobDataMap [英] Update an existing JobDataMap

查看:694
本文介绍了更新现有的JobDataMap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已安排的Quartz作业。我想更新与之关联的JobDataMap。如果我得到一个带有 JobDataMap jobDataMap = scheduler.getJobDetail(....)。getJobDataMap()的JobDataMap,该地图是实时吗?即。如果我改变它,它会被保存在调度程序中吗?如果没有,我该如何坚持?

I have a Quartz job that has already been scheduled. I want to update the JobDataMap associated with it. If I get a JobDataMap with JobDataMap jobDataMap = scheduler.getJobDetail(....).getJobDataMap(), is that map "live"? ie. if I change it, will it be persisted in the scheduler? If not, how do I persist it?

推荐答案

参见 http://www.quartz-scheduler.org/docs/tutorial/TutorialLesson03.html


作业实例可以定义为
有状态或无状态。
非有状态作业只有在
添加到调度程序时才存储
JobDataMap。这意味着
,在执行
的工作期间对作业数据地图的内容
所做的任何更改都将丢失,并且在下次作业时看不到

执行。

A Job instance can be defined as "stateful" or "non-stateful". Non-stateful jobs only have their JobDataMap stored at the time they are added to the scheduler. This means that any changes made to the contents of the job data map during execution of the job will be lost, and will not seen by the job the next time it executes.

...有状态的工作恰恰相反 -
每次执行
后,其JobDataMap将被重新存储这个工作。

...a stateful job is just the opposite - its JobDataMap is re-stored after every execution of the job.

通过让它实现StatefulJob
接口,而不是Job
接口,你'将'作为有状态标记' 。

这篇关于更新现有的JobDataMap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆