properties: # quartz原生配置
org:
quartz:
scheduler:
instanceName: DcScheduler # 调度器实例名称
instanceId: AUTO # 调度器实例ID自动生成
makeSchedulerThreadDaemon: true
# JobStore 相关配置
jobStore:
acquireTriggersWithinLock: true
class: org.quartz.impl.jdbcjobstore.JobStoreTX # JobStore 实现类
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # 使用完全兼容JDBC的驱动
tablePrefix: qrtz_ # Quartz 表前缀
useProperties: false # 是否将JobDataMap中的属性转为字符串存储
isClustered: true
clusterCheckinInterval: 5000
为什么添加了 acquireTriggersWithinLock: true ,任务还是会重复执行
@DisallowConcurrentExecution
public class MyJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
// code for job execution
}
}