本文整理汇总了Java中org.quartz.Scheduler.unscheduleJob方法的典型用法代码示例。如果您正苦于以下问题:Java Scheduler.unscheduleJob方法的具体用法?Java Scheduler.unscheduleJob怎么用?Java Scheduler.unscheduleJob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.Scheduler
的用法示例。
在下文中一共展示了Scheduler.unscheduleJob方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeJob
import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
* @Description 移除一个任务(使用默认的任务组名,触发器名,触发器组名)
* @param jobName
*
*
*/
public static void removeJob(String jobName) {
TriggerKey triggerKey = TriggerKey.triggerKey(
jobName, TRIGGER_GROUP_NAME);
JobKey jobKey = JobKey.jobKey(jobName, JOB_GROUP_NAME);
try {
Scheduler sched = gSchedulerFactory.getScheduler();
Trigger trigger = (Trigger) sched.getTrigger(triggerKey);
if (trigger == null) {
return;
}
sched.pauseTrigger(triggerKey);;// 停止触发器
sched.unscheduleJob(triggerKey);// 移除触发器
sched.deleteJob(jobKey);// 删除任务
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: unscheduleAll
import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
* Remove all schedules matching the given predicate from the current
* scheduler, then from the data base.
*/
private void unscheduleAll(final Predicate<TriggerKey> predicate) throws SchedulerException {
// Remove current schedules from the memory
final Scheduler scheduler = vmSchedulerFactoryBean.getObject();
for (final TriggerKey triggerKey : scheduler.getTriggerKeys(GroupMatcher.groupEquals(SCHEDULE_TRIGGER_GROUP))) {
if (predicate.test(triggerKey)) {
// Match subscription and operation, unschedule this trigger
scheduler.unscheduleJob(triggerKey);
}
}
}
示例3: deleteJobTrigger
import org.quartz.Scheduler; //导入方法依赖的package包/类
@Transactional
@Override
public boolean deleteJobTrigger(TriggerKey triggerKey) {
try {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
return scheduler.unscheduleJob(triggerKey);
} catch (SchedulerException e) {
throw new ServiceException(e);
}
}
示例4: removeJobFromScheduler
import org.quartz.Scheduler; //导入方法依赖的package包/类
public void removeJobFromScheduler(String jobDefId,String companyId) throws SchedulerException {
Scheduler scheduler=schedulerService.retrieveScheduler();
JobKey jobKey=new JobKey(JOB_PREFIX+jobDefId,companyId);
TriggerKey triggerKey=new TriggerKey(TRIGGER_PREFIX+jobDefId,companyId);
if(scheduler.checkExists(jobKey)){
scheduler.pauseTrigger(triggerKey);
scheduler.unscheduleJob(triggerKey);
scheduler.deleteJob(jobKey);
}
}
示例5: removeTrigger
import org.quartz.Scheduler; //导入方法依赖的package包/类
public static void removeTrigger(String triggerName, String triggerGroup, Scheduler scheduler) throws SchedulerException {
TriggerKey triggerKey = getTriggerKey(triggerName, triggerGroup);
scheduler.unscheduleJob(triggerKey);
}