心地善良的人、富于幻想的人比冷酷残忍的人更容易聚合——约翰逊

quartz之前我们也聊过了,今天说下这个注解org.quartz.PersistJobDataAfterExecution

一般和DisallowConcurrentExecution搭配使用

PersistJobDataAfterExecution表示Job执行结束后更新JobDataMap

DisallowConcurrentExecution表示不允许并发执行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@Slf4j
@DisallowConcurrentExecution
@PersistJobDataAfterExecution
public class SettlementJob implements Job {

/**
* <p>
* Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
* fires that is associated with the <code>Job</code>.
* </p>
*
* <p>
* The implementation may wish to set a
* {@link JobExecutionContext#setResult(Object) result} object on the
* {@link JobExecutionContext} before this method exits. The result itself
* is meaningless to Quartz, but may be informative to
* <code>{@link JobListener}s</code> or
* <code>{@link TriggerListener}s</code> that are watching the job's
* execution.
* </p>
*
* @param context 上下文
* @throws JobExecutionException if there is an exception while executing the job.
*/
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
final JobDetail jobDetail = context.getJobDetail();
final JobDataMap jobDataMap = jobDetail.getJobDataMap();
log.info(jobDetail.getKey().getName() + "执行了");
}
}