NutzCN Logo
短点 job_878cd98d
发布于 3112天前 作者 明天会吹什么风 2022 次浏览 复制 上一个帖子 下一个帖子
标签:

查看完整内容

QuartzJobBean job = null;
		Scheduler scheduler = schedulerFactoryBean.getScheduler();
		TriggerKey triggerKey = TriggerKey.triggerKey(jobName, jobGroup);
		CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);  
		if (null != trigger) {
			job = new QuartzJobBean();
	        job.setJobName(jobName);
	        job.setJobGroup(jobGroup);
	        job.setDescription("触发器:" + trigger.getKey());
	        job.setNextTime(trigger.getNextFireTime()); //下次触发时间
	        job.setPreviousTime(trigger.getPreviousFireTime());//上次触发时间
	        Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
	        job.setJobStatus(triggerState.name());
	        if (trigger instanceof CronTrigger) {
	            CronTrigger cronTrigger = (CronTrigger) trigger;
	            String cronExpression = cronTrigger.getCronExpression();
	            job.setCronExpression(cronExpression);
	        }
		}		
        return job;
0 回复
添加回复
请先登陆
回到顶部