泛微oa帮助文档之判断JOB是否正在运行

//查找正在运行的JOB
public static boolean isExecutingJob(String jobName){
    
    
	Boolean flag = false;
	String findName = "schedule."+jobName;
	//获取正在运行的JOB
	try {
    
    
		Scheduler scheduler = new StdSchedulerFactory().getScheduler();
		List<JobExecutionContext> jobContexts = scheduler.getCurrentlyExecutingJobs();
		for (JobExecutionContext context : jobContexts) {
    
    
			if (findName.equals(context.getTrigger().getJobName())){
    
    
				flag = true;
				break;
			}
		}
	} catch (SchedulerException e) {
    
    
		e.printStackTrace();
	}
	return flag;
}	

请在评论区留言,共同探讨~~~

如有需要,请联系微信:hdygzh2019 同时请说明来意,共同进步!!!

猜你喜欢

转载自blog.csdn.net/Y_6155/article/details/109018658