使用jobstoretx,如何获取数据库中已经存在的trigger的cron表达式?
我试过了,但没用。
@Bean
public CronTriggerFactoryBean cancelamentoTrigger(@Qualifier("cancelamentoJobDetail") JobDetail job, JobStore jobStore) throws JobPersistenceException {
CronTriggerFactoryBean trigger = new CronTriggerFactoryBean();
trigger.setJobDetail(job);
TriggerKey cancelamentoTrigger = new TriggerKey("cancelamentoTrigger");
if (jobStore.checkExists(cancelamentoTrigger)) {
trigger.setCronExpression(((CronTrigger) scheduler.getTrigger(cancelamentoTrigger)).getCronExpression());
} else {
trigger.setCronExpression("0/30 0/1 * 1/1 * ? *");
}
return trigger;
}
暂无答案!
目前还没有任何答案,快来回答吧!