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


Java JobExecutionContext.getTrigger方法代码示例

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


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

示例1: getRunningJob

import org.quartz.JobExecutionContext; //导入方法依赖的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: jobToBeExecuted

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobToBeExecuted(JobExecutionContext)
 */
public void jobToBeExecuted(JobExecutionContext context) {
    if (!getLog().isInfoEnabled()) {
        return;
    } 
    
    Trigger trigger = context.getTrigger();

    Object[] args = {
        context.getJobDetail().getKey().getName(),
        context.getJobDetail().getKey().getGroup(), new java.util.Date(),
        trigger.getKey().getName(), trigger.getKey().getGroup(),
        trigger.getPreviousFireTime(), trigger.getNextFireTime(),
        Integer.valueOf(context.getRefireCount())
    };

    getLog().info(MessageFormat.format(getJobToBeFiredMessage(), args));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:LoggingJobHistoryPlugin.java

示例3: jobExecutionVetoed

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
 */
public void jobExecutionVetoed(JobExecutionContext context) {
    
    if (!getLog().isInfoEnabled()) {
        return;
    } 
    
    Trigger trigger = context.getTrigger();

    Object[] args = {
        context.getJobDetail().getKey().getName(),
        context.getJobDetail().getKey().getGroup(), new java.util.Date(),
        trigger.getKey().getName(), trigger.getKey().getGroup(),
        trigger.getPreviousFireTime(), trigger.getNextFireTime(),
        Integer.valueOf(context.getRefireCount())
    };

    getLog().info(MessageFormat.format(getJobWasVetoedMessage(), args));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:LoggingJobHistoryPlugin.java

示例4: jobToBeExecuted

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobToBeExecuted(JobExecutionContext)
 */
public void jobToBeExecuted(JobExecutionContext context) {
    if (!getLog().isInfoEnabled()) {
        return;
    } 
    
    Trigger trigger = context.getTrigger();

    Object[] args = {
        context.getJobDetail().getName(),
        context.getJobDetail().getGroup(), new java.util.Date(),
        trigger.getName(), trigger.getGroup(),
        trigger.getPreviousFireTime(), trigger.getNextFireTime(),
        new Integer(context.getRefireCount())
    };

    getLog().info(MessageFormat.format(getJobToBeFiredMessage(), args));
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:21,代码来源:LoggingJobHistoryPlugin.java

示例5: jobExecutionVetoed

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
 */
public void jobExecutionVetoed(JobExecutionContext context) {
    
    if (!getLog().isInfoEnabled()) {
        return;
    } 
    
    Trigger trigger = context.getTrigger();

    Object[] args = {
        context.getJobDetail().getName(),
        context.getJobDetail().getGroup(), new java.util.Date(),
        trigger.getName(), trigger.getGroup(),
        trigger.getPreviousFireTime(), trigger.getNextFireTime(),
        new Integer(context.getRefireCount())
    };

    getLog().info(MessageFormat.format(getJobWasVetoedMessage(), args));
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:22,代码来源:LoggingJobHistoryPlugin.java

示例6: getRunningJobList

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
@Override
public List<ScheduleJobEntity> getRunningJobList() {
	List<ScheduleJobEntity> jobList = null;
	Scheduler scheduler = schedulerFactoryBean.getScheduler();
	try {
	List<JobExecutionContext> executingJobList = scheduler.getCurrentlyExecutingJobs();
	jobList = new ArrayList<>(executingJobList.size());
	for (JobExecutionContext executingJob : executingJobList) {
		ScheduleJobEntity scheduleJob = new ScheduleJobEntity();
		JobDetail jobDetail = executingJob.getJobDetail();
		JobKey jobKey = jobDetail.getKey();
		Trigger trigger = executingJob.getTrigger();
		this.wrapScheduleJob(scheduleJob, scheduler, jobKey, trigger);
		jobList.add(scheduleJob);
	}
	} catch (Exception e) {
		logger.error("获取计划任务列表失败", e);
		throw new ServiceException("获取计划任务列表失败", e);
	}
	return jobList;
}
 
开发者ID:wjggwm,项目名称:webside,代码行数:22,代码来源:ScheduleJobServiceImpl.java

示例7: jobWasExecuted

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobWasExecuted(JobExecutionContext, JobExecutionException)
 */
public void jobWasExecuted(JobExecutionContext context,
        JobExecutionException jobException) {

    Trigger trigger = context.getTrigger();
    
    Object[] args = null;
    
    if (jobException != null) {
        if (!getLog().isWarnEnabled()) {
            return;
        } 
        
        String errMsg = jobException.getMessage();
        args = 
            new Object[] {
                context.getJobDetail().getKey().getName(),
                context.getJobDetail().getKey().getGroup(), new java.util.Date(),
                trigger.getKey().getName(), trigger.getKey().getGroup(),
                trigger.getPreviousFireTime(), trigger.getNextFireTime(),
                Integer.valueOf(context.getRefireCount()), errMsg
            };
        
        getLog().warn(MessageFormat.format(getJobFailedMessage(), args), jobException); 
    } else {
        if (!getLog().isInfoEnabled()) {
            return;
        } 
        
        String result = String.valueOf(context.getResult());
        args =
            new Object[] {
                context.getJobDetail().getKey().getName(),
                context.getJobDetail().getKey().getGroup(), new java.util.Date(),
                trigger.getKey().getName(), trigger.getKey().getGroup(),
                trigger.getPreviousFireTime(), trigger.getNextFireTime(),
                Integer.valueOf(context.getRefireCount()), result
            };
        
        getLog().info(MessageFormat.format(getJobSuccessMessage(), args));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:LoggingJobHistoryPlugin.java

示例8: jobWasExecuted

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/** 
 * @see org.quartz.JobListener#jobWasExecuted(JobExecutionContext, JobExecutionException)
 */
public void jobWasExecuted(JobExecutionContext context,
        JobExecutionException jobException) {

    Trigger trigger = context.getTrigger();
    
    Object[] args = null;
    
    if (jobException != null) {
        if (!getLog().isWarnEnabled()) {
            return;
        } 
        
        String errMsg = jobException.getMessage();
        args = 
            new Object[] {
                context.getJobDetail().getName(),
                context.getJobDetail().getGroup(), new java.util.Date(),
                trigger.getName(), trigger.getGroup(),
                trigger.getPreviousFireTime(), trigger.getNextFireTime(),
                new Integer(context.getRefireCount()), errMsg
            };
        
        getLog().warn(MessageFormat.format(getJobFailedMessage(), args), jobException); 
    } else {
        if (!getLog().isInfoEnabled()) {
            return;
        } 
        
        String result = String.valueOf(context.getResult());
        args =
            new Object[] {
                context.getJobDetail().getName(),
                context.getJobDetail().getGroup(), new java.util.Date(),
                trigger.getName(), trigger.getGroup(),
                trigger.getPreviousFireTime(), trigger.getNextFireTime(),
                new Integer(context.getRefireCount()), result
            };
        
        getLog().info(MessageFormat.format(getJobSuccessMessage(), args));
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:45,代码来源:LoggingJobHistoryPlugin.java

示例9: execute

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/**
 * Calls the feed notifier to do its work
 */
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    
    final FeedNotifier feedNotifier = (FeedNotifier)jobData.get(KEY_FEED_NOTIFIER);
    final TenantAdminService tenantAdminService = (TenantAdminService)jobData.get(KEY_TENANT_ADMIN_SERVICE);
    
    Long repeatInterval = null;
    Trigger trigger = context.getTrigger();
    if (trigger instanceof SimpleTrigger)
    {
        repeatInterval = ((SimpleTrigger)trigger).getRepeatInterval();
    }
    
    final int repeatIntervalMins = new Long(repeatInterval == null ? 0L : repeatInterval / 1000 / 60).intValue();
    
    AuthenticationUtil.runAs(new RunAsWork<Object>()
    {
        public Object doWork() throws Exception
        {
            feedNotifier.execute(repeatIntervalMins);
            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
    
    if ((tenantAdminService != null) && tenantAdminService.isEnabled())
    {
        List<Tenant> tenants = tenantAdminService.getAllTenants();
        for (Tenant tenant : tenants)
        {
            TenantUtil.runAsSystemTenant(new TenantRunAsWork<Object>()
            {
                public Object doWork() throws Exception
                {
                    feedNotifier.execute(repeatIntervalMins);
                    return null;
                }
            }, tenant.getTenantDomain());
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:FeedNotifierJob.java

示例10: getRunningJobList

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
public List<ScheduleJob> getRunningJobList() throws SchedulerException{  
    List<JobExecutionContext> executingJobList = scheduler.getCurrentlyExecutingJobs();  
    List<ScheduleJob> jobList = new ArrayList<>(executingJobList.size());  
    for(JobExecutionContext executingJob : executingJobList){  
        ScheduleJob scheduleJob = new ScheduleJob();  
        JobDetail jobDetail = executingJob.getJobDetail();  
        JobKey jobKey = jobDetail.getKey();  
        Trigger trigger = executingJob.getTrigger();  
        this.wrapScheduleJob(scheduleJob,scheduler,jobKey,trigger);  
        jobList.add(scheduleJob);  
    }  
    return jobList;  
}
 
开发者ID:jiwenxing,项目名称:springboot-quartz,代码行数:14,代码来源:ScheduleJobService.java


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