org.quartz.Scheduler#getCurrentlyExecutingJobs ( )源码实例Demo

下面列出了org.quartz.Scheduler#getCurrentlyExecutingJobs ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: sakai   文件: SchedulerTool.java
/**
 * This method runs the current job only once, right now
 * @return int 0 if it's not running, 1 if it is, 2 if there is an error
 */
public int getSelectedJobRunning()
{
   Scheduler scheduler = schedulerManager.getScheduler();
   if (scheduler == null)
   {
     log.error("Scheduler is down!");
     return 2;
   }
   try
   {
      List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
      JobKey selected = selectedJobDetailWrapper.getJobDetail().getKey();

      for (JobExecutionContext jobExecutionContext : executingJobs) {
         if(selected.equals(jobExecutionContext.getJobDetail().getKey()) )
            return 1;
      }
      return 0;
   }
   catch (Exception e)
   {
     log.error("Failed to trigger job now", e);
     return 2;
   }
}
 
源代码2 项目: sakai   文件: SchedulerTool.java
public List<JobExecutionContextWrapperBean> getRunningJobs() {
 List<JobExecutionContext> currentJobs = new ArrayList<JobExecutionContext>();
 List<JobExecutionContextWrapperBean> currentWrappedJobs = new ArrayList<JobExecutionContextWrapperBean>();
 Scheduler scheduler = schedulerManager.getScheduler();
 if (scheduler == null)
 {
  log.error("Scheduler is down!");
 }
 else {
  try {
	  currentJobs = scheduler.getCurrentlyExecutingJobs();
  } catch (SchedulerException e) {
	  log.warn("Unable to get currently executing jobs");
  }
 }

 for (JobExecutionContext jec : currentJobs)
 {
  JobExecutionContextWrapperBean jobExecutionContextWrapper = new JobExecutionContextWrapperBean(this, jec);
  jobExecutionContextWrapper.setIsKillable(isJobKillable(jec.getJobDetail()));
  currentWrappedJobs.add(jobExecutionContextWrapper);
 }

 return currentWrappedJobs;
}
 
源代码3 项目: sakai   文件: SchedulerTool.java
/**
 * This method runs the current job only once, right now
 * @return int 0 if it's not running, 1 if it is, 2 if there is an error
 */
public int getSelectedJobRunning()
{
   Scheduler scheduler = schedulerManager.getScheduler();
   if (scheduler == null)
   {
     log.error("Scheduler is down!");
     return 2;
   }
   try
   {
      List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
      JobKey selected = selectedJobDetailWrapper.getJobDetail().getKey();

      for (JobExecutionContext jobExecutionContext : executingJobs) {
         if(selected.equals(jobExecutionContext.getJobDetail().getKey()) )
            return 1;
      }
      return 0;
   }
   catch (Exception e)
   {
     log.error("Failed to trigger job now", e);
     return 2;
   }
}
 
源代码4 项目: sakai   文件: SchedulerTool.java
public List<JobExecutionContextWrapperBean> getRunningJobs() {
 List<JobExecutionContext> currentJobs = new ArrayList<JobExecutionContext>();
 List<JobExecutionContextWrapperBean> currentWrappedJobs = new ArrayList<JobExecutionContextWrapperBean>();
 Scheduler scheduler = schedulerManager.getScheduler();
 if (scheduler == null)
 {
  log.error("Scheduler is down!");
 }
 else {
  try {
	  currentJobs = scheduler.getCurrentlyExecutingJobs();
  } catch (SchedulerException e) {
	  log.warn("Unable to get currently executing jobs");
  }
 }

 for (JobExecutionContext jec : currentJobs)
 {
  JobExecutionContextWrapperBean jobExecutionContextWrapper = new JobExecutionContextWrapperBean(this, jec);
  jobExecutionContextWrapper.setIsKillable(isJobKillable(jec.getJobDetail()));
  currentWrappedJobs.add(jobExecutionContextWrapper);
 }

 return currentWrappedJobs;
}
 
源代码5 项目: nextreports-server   文件: QuartzUtil.java
public static List<String> getRunningJobNames(Scheduler scheduler) throws SchedulerException {
	List<JobExecutionContext> jobs = scheduler.getCurrentlyExecutingJobs();

	List<String> runningJobs = new ArrayList<String>();
	for (JobExecutionContext job : jobs) {
		runningJobs.add(job.getJobDetail().getKey().getName());
	}

	return runningJobs;
}
 
源代码6 项目: nextreports-server   文件: QuartzUtil.java
public static Map<String, JobExecutionContext> getRunningJobs(Scheduler scheduler) throws SchedulerException {
	Map<String, JobExecutionContext> runningJobs = new HashMap<String, JobExecutionContext>();
	List<JobExecutionContext> jobs = scheduler.getCurrentlyExecutingJobs();
	for (JobExecutionContext context : jobs) {
		runningJobs.put(context.getJobDetail().getKey().getName(), context);
	}
	
	return runningJobs;		
}