本文整理匯總了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);
}