当前位置: 首页>>代码示例>>Java>>正文


Java Trigger.TriggerState方法代码示例

本文整理汇总了Java中org.quartz.Trigger.TriggerState方法的典型用法代码示例。如果您正苦于以下问题:Java Trigger.TriggerState方法的具体用法?Java Trigger.TriggerState怎么用?Java Trigger.TriggerState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.Trigger的用法示例。


在下文中一共展示了Trigger.TriggerState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRunningJob

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * 所有正在运行的job
 * 
 * @return
 * @throws SchedulerException
 */
public List<ScheduleJob> getRunningJob() throws SchedulerException {
    Scheduler scheduler = schedulerFactoryBean.getScheduler();
    List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
    List<ScheduleJob> jobList = new ArrayList<ScheduleJob>(executingJobs.size());
    for (JobExecutionContext executingJob : executingJobs) {
        ScheduleJob job = new ScheduleJob();
        JobDetail jobDetail = executingJob.getJobDetail();
        JobKey jobKey = jobDetail.getKey();
        Trigger trigger = executingJob.getTrigger();
        job.setName(jobKey.getName());
        job.setGroup(jobKey.getGroup());
        job.setDescription("触发器:" + trigger.getKey());
        Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
        job.setStatus(triggerState.name());
        if (trigger instanceof CronTrigger) {
            CronTrigger cronTrigger = (CronTrigger) trigger;
            String cronExpression = cronTrigger.getCronExpression();
            job.setCron(cronExpression);
        }
        jobList.add(job);
    }
    return jobList;
}
 
开发者ID:Zigin,项目名称:MonitorPlatform,代码行数:30,代码来源:JobConfigService.java

示例2: getAllJob

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * 获取所有计划中的任务列表
 * 
 * @return
 * @throws SchedulerException
 */
public List<ScheduleJob> getAllJob() throws SchedulerException {
    Scheduler scheduler = schedulerFactoryBean.getScheduler();
    GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
    Set<JobKey> jobKeys = scheduler.getJobKeys(matcher);
    List<ScheduleJob> jobList = new ArrayList<ScheduleJob>();
    for (JobKey jobKey : jobKeys) {
        List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
        for (Trigger trigger : triggers) {
            ScheduleJob job = new ScheduleJob();
            job.setName(jobKey.getName());
            job.setGroup(jobKey.getGroup());
            job.setDescription("触发器:" + trigger.getKey());
            Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
            job.setStatus(triggerState.name());
            if (trigger instanceof CronTrigger) {
                CronTrigger cronTrigger = (CronTrigger) trigger;
                String cronExpression = cronTrigger.getCronExpression();
                job.setCron(cronExpression);
            }
            jobList.add(job);
        }
    }
    return jobList;
}
 
开发者ID:Zigin,项目名称:MonitorPlatform,代码行数:31,代码来源:JobConfigService.java

示例3: getTriggerState

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * <p>
 * Get the current state of the identified <code>{@link Trigger}</code>.
 * </p>
 * 
 * @see Trigger.TriggerState
 */
@Override
public Trigger.TriggerState getTriggerState(org.quartz.TriggerKey key) throws JobPersistenceException {

  TriggerWrapper tw;
  lock();
  try {
    tw = triggerFacade.get(key);
  } finally {
    unlock();
  }

  if (tw == null) { return Trigger.TriggerState.NONE; }

  if (tw.getState() == TriggerState.COMPLETE) { return Trigger.TriggerState.COMPLETE; }

  if (tw.getState() == TriggerState.PAUSED) { return Trigger.TriggerState.PAUSED; }

  if (tw.getState() == TriggerState.PAUSED_BLOCKED) { return Trigger.TriggerState.PAUSED; }

  if (tw.getState() == TriggerState.BLOCKED) { return Trigger.TriggerState.BLOCKED; }

  if (tw.getState() == TriggerState.ERROR) { return Trigger.TriggerState.ERROR; }

  return Trigger.TriggerState.NORMAL;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:DefaultClusteredJobStore.java

示例4: wrapScheduleJob

import org.quartz.Trigger; //导入方法依赖的package包/类
private void wrapScheduleJob(ScheduleJob scheduleJob,Scheduler scheduler,JobKey jobKey,Trigger trigger){  
    try {  
        scheduleJob.setJobName(jobKey.getName());  
        scheduleJob.setJobGroup(jobKey.getGroup()); 
  
        JobDetail jobDetail = scheduler.getJobDetail(jobKey);  
        ScheduleJob job = (ScheduleJob)jobDetail.getJobDataMap().get("scheduleJob");  
        scheduleJob.setDesc(job.getDesc());  
        scheduleJob.setJobId(job.getJobId());
  
        Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());  
        scheduleJob.setJobStatus(triggerState.name());  
        if(trigger instanceof CronTrigger){  
            CronTrigger cronTrigger = (CronTrigger)trigger;  
            String cronExpression = cronTrigger.getCronExpression();  
            scheduleJob.setCronExpression(cronExpression);  
        }  
    } catch (SchedulerException e) {  
        e.printStackTrace(); 
    }  
}
 
开发者ID:jiwenxing,项目名称:springboot-quartz,代码行数:22,代码来源:ScheduleJobService.java

示例5: getTriggerState

import org.quartz.Trigger; //导入方法依赖的package包/类
@Override
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey) throws JobPersistenceException {
  try {
    return realJobStore.getTriggerState(triggerKey);
  } catch (RejoinException e) {
    throw new JobPersistenceException("Trigger state retrieval failed due to client rejoin", e);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AbstractTerracottaJobStore.java

示例6: wrapScheduleJob

import org.quartz.Trigger; //导入方法依赖的package包/类
/**
 * 封装ScheduleJob对象
 * 
 * @param scheduleJob
 * @param scheduler
 * @param jobKey
 * @param trigger
 */
private void wrapScheduleJob(ScheduleJobEntity scheduleJob,
		Scheduler scheduler, JobKey jobKey, Trigger trigger) {
	try {
		scheduleJob.setJobName(jobKey.getName());
		scheduleJob.setJobGroup(jobKey.getGroup());

		JobDetail jobDetail = scheduler.getJobDetail(jobKey);
		scheduleJob.setJobClass(jobDetail.getJobClass());
		scheduleJob.setJobDesc(jobDetail.getDescription());
		
		Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
		scheduleJob.setTriggerStatus(triggerState.name());
		
		if (trigger instanceof CronTrigger) {
			CronTrigger cronTrigger = (CronTrigger) trigger;
			TriggerKey triggerKey = cronTrigger.getKey();
			scheduleJob.setTriggerName(triggerKey.getName());
			scheduleJob.setTriggerGroup(triggerKey.getGroup());
			scheduleJob.setNextFireTime(cronTrigger.getNextFireTime());
			scheduleJob.setCronExpression(cronTrigger.getCronExpression());
			scheduleJob.setStartDate(cronTrigger.getStartTime());
			scheduleJob.setEndDate(cronTrigger.getEndTime());
		}
	} catch (SchedulerException e) {
		logger.error("获取触发器状态失败", e);
		throw new ServiceException(e);
	}
}
 
开发者ID:wjggwm,项目名称:webside,代码行数:37,代码来源:ScheduleJobServiceImpl.java

示例7: getTriggerState

import org.quartz.Trigger; //导入方法依赖的package包/类
@Override
public Trigger.TriggerState getTriggerState(final TriggerKey triggerKey) throws JobPersistenceException {
  return clusteredJobStore.getTriggerState(triggerKey);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PlainTerracottaJobStore.java

示例8: getTriggerState

import org.quartz.Trigger; //导入方法依赖的package包/类
public Trigger.TriggerState getTriggerState(String schedulerName, Trigger trigger) throws SchedulerException {
    Assert.notNull(trigger, "trigger can not be null");
    Scheduler scheduler = this.getAssertScheduler(schedulerName);
    return QuartzUtils.getTriggerState(trigger, scheduler);
}
 
开发者ID:quartzweb,项目名称:quartz-web,代码行数:6,代码来源:QuartzManager.java


注:本文中的org.quartz.Trigger.TriggerState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。