本文整理了Java中org.quartz.Scheduler.triggerJob()
方法的一些代码示例,展示了Scheduler.triggerJob()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.triggerJob()
方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:triggerJob
[英]Trigger the identified org.quartz.JobDetail
(execute it now) - the generated trigger will be non-volatile.
[中]触发已识别的org.quartz.JobDetail
(立即执行)-生成的触发器将是非易失性的。
代码示例来源:origin: quartz-scheduler/quartz
@Override
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
JobKey sj = chainLinks.get(context.getJobDetail().getKey());
if(sj == null) {
return;
}
getLog().info("Job '" + context.getJobDetail().getKey() + "' will now chain to Job '" + sj + "'");
try {
context.getScheduler().triggerJob(sj);
} catch(SchedulerException se) {
getLog().error("Error encountered during chaining to Job '" + sj + "'", se);
}
}
}
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
/**
* 立即执行任务
*/
public static void run(Scheduler scheduler, Job scheduleJob) {
try {
// 参数
JobDataMap dataMap = new JobDataMap();
dataMap.put(Job.JOB_PARAM_KEY, scheduleJob);
scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap);
} catch (SchedulerException e) {
log.error("执行定时任务失败", e);
}
}
代码示例来源:origin: quartz-scheduler/quartz
@Override
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
JobKey sj = chainLinks.get(context.getJobDetail().getKey());
if(sj == null) {
return;
}
getLog().info("Job '" + context.getJobDetail().getKey() + "' will now chain to Job '" + sj + "'");
try {
context.getScheduler().triggerJob(sj);
} catch(SchedulerException se) {
getLog().error("Error encountered during chaining to Job '" + sj + "'", se);
}
}
}
代码示例来源:origin: elasticjob/elastic-job-lite
/**
* 立刻启动作业.
*/
public synchronized void triggerJob() {
try {
if (!scheduler.isShutdown()) {
scheduler.triggerJob(jobDetail.getKey());
}
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
}
代码示例来源:origin: bill1012/AdminEAP
/**
* 运行一次
*/
public void triggerJob(ScheduleJob scheduleJob) throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
scheduler.triggerJob(jobKey);
}
代码示例来源:origin: sanluan/PublicCMS
/**
* 执行任务计划
*
* @param site
* @param id
*/
public void runOnce(SysSite site, Integer id) {
if (CommonUtils.notEmpty(id)) {
Date startTime = CommonUtils.getDate();
try {
scheduler.triggerJob(JobKey.jobKey(getTaskName(id)));
} catch (SchedulerException e) {
sysTaskService.updateStatus(id, TASK_STATUS_ERROR);
logTaskService.save(new LogTask(site.getId(), id, startTime, CommonUtils.getDate(), false, e.getMessage()));
}
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
* 执行任务计划
*
* @param site
* @param id
*/
public void runOnce(SysSite site, Integer id) {
if (CommonUtils.notEmpty(id)) {
Date startTime = CommonUtils.getDate();
try {
scheduler.triggerJob(JobKey.jobKey(getTaskName(id)));
} catch (SchedulerException e) {
sysTaskService.updateStatus(id, TASK_STATUS_ERROR);
logTaskService.save(new LogTask(site.getId(), id, startTime, CommonUtils.getDate(), false, e.getMessage()));
}
}
}
代码示例来源:origin: yejq/quartz-spring-manager
@RequestMapping(value = "/triggerTrigger", method = RequestMethod.GET)
public String triggerTrigger(String name, String group, Model model) {
try {
scheduler.triggerJob(name, group);
} catch (Exception e) {
model.addAttribute("hasError", "true");
e.printStackTrace();
}
return "redirect:/scheduler/";
}
代码示例来源:origin: org.codelibs/elasticsearch-quartz
public void triggerJob(final JobKey jobKey) {
try {
scheduler.triggerJob(jobKey);
} catch (final SchedulerException e) {
throw new QuartzSchedulerException(e);
}
}
代码示例来源:origin: org.codelibs/elasticsearch-quartz
public void triggerJob(final JobKey jobKey, final JobDataMap data) {
try {
scheduler.triggerJob(jobKey, data);
} catch (final SchedulerException e) {
throw new QuartzSchedulerException(e);
}
}
代码示例来源:origin: lvhao/schedule-job
public boolean triggerNow(JobKey jobKey, JobDataMap jobDataMap){
try {
scheduler.triggerJob(jobKey,jobDataMap);
return true;
} catch (SchedulerException e) {
e.printStackTrace();
}
return false;
}
代码示例来源:origin: org.opensingular/singular-flow-schedule
/**
* Trigger the identified {@link org.quartz.JobDetail} (execute it now).
*
* @param jobKey
* @throws SchedulerException
*/
public void triggerJob(JobKey jobKey) throws SchedulerException{
getScheduler().triggerJob(jobKey);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
@Override
public void runJob(String jobId) {
try {
scheduler.triggerJob(new JobKey(jobId));
} catch (SchedulerException e) {
throw new JobNotFoundException(e);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-quartz
@Override
public void triggerJob(JobKey jobKey) throws QuartzException {
try {
delegate.triggerJob(jobKey);
} catch (SchedulerException e) {
Logger.error(e.getMessage());
throw new QuartzException(e);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz
@Override
public void triggerJob(JobKey jobKey, JobDataMap data) throws QuartzException {
try {
delegate.triggerJob(jobKey, data);
} catch (SchedulerException e) {
Logger.error(e.getMessage());
throw new QuartzException(e);
}
}
代码示例来源:origin: com.dangdang/elastic-job-lite-core
/**
* 立刻启动作业.
*/
public synchronized void triggerJob() {
try {
if (!scheduler.isShutdown()) {
scheduler.triggerJob(jobDetail.getKey());
}
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
}
代码示例来源:origin: org.jabylon/scheduler
@Override
public void trigger(Preferences jobConfig) throws ScheduleServiceException {
try {
scheduler.triggerJob(new JobKey(jobConfig.absolutePath()));
} catch (SchedulerException e) {
throw new ScheduleServiceException(e);
}
}
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
private void scheduleExecution(Scheduler scheduler) {
final String jobName = _schedule.getJob().getName();
final String tenantId = _schedule.getTenant().getId();
try {
scheduler.triggerJob(new JobKey(jobName, tenantId));
} catch (SchedulerException e) {
logger.error("Failed to trigger job " + jobName + " for tenant " + tenantId, e);
}
}
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public void executeNow(final long jobId, final String groupName, final String jobName, final boolean disallowConcurrentExecution)
throws SSchedulerException {
try {
checkSchedulerState();
final JobDetail jobDetail = getJobDetail(jobId, groupName, jobName, disallowConcurrentExecution);
scheduler.addJob(jobDetail, true);
scheduler.triggerJob(jobDetail.getKey());
} catch (final Exception e) {
throw new SSchedulerException(e);
}
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public void executeNow(final long jobId, final String groupName, final String jobName, final boolean disallowConcurrentExecution)
throws SSchedulerException {
try {
checkSchedulerState();
final JobDetail jobDetail = getJobDetail(jobId, groupName, jobName, disallowConcurrentExecution);
scheduler.addJob(jobDetail, true);
scheduler.triggerJob(jobDetail.getKey());
} catch (final Exception e) {
throw new SSchedulerException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!