本文整理了Java中org.quartz.Scheduler.pauseTriggers()
方法的一些代码示例,展示了Scheduler.pauseTriggers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.pauseTriggers()
方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:pauseTriggers
[英]Pause all of the Triggers
in the groups matching.
The Scheduler will "remember" all the groups paused, and impose the pause on any new triggers that are added to any of those groups until it is resumed.
NOTE: There is a limitation that only exactly matched groups can be remembered as paused. For example, if there are pre-existing triggers in groups "aaa" and "bbb" and a matcher is given to pause groups that start with "a" then the group "aaa" will be remembered as paused and any subsequently added triggers in that group be paused, however if a trigger is added to group "axx" it will not be paused, as "axx" wasn't known at the time the "group starts with a" matcher was applied. HOWEVER, if there are pre-existing groups "aaa" and "bbb" and a matcher is given to pause the group "axx" (with a group equals matcher) then no triggers will be paused, but it will be remembered that group "axx" is paused and later when a trigger is added in that group, it will become paused.
[中]暂停匹配组中的所有Triggers
。
调度程序将“记住”所有暂停的组,并对添加到这些组中的任何新触发器施加暂停,直到恢复为止。
注意:有一个限制,只有完全匹配的组才能被记忆为暂停。例如,如果在“aaa”和“bbb”组中存在预先存在的触发器,并且提供了一个匹配器来暂停以“a”开头的组,则组“aaa”将被记为已暂停,并且该组中随后添加的任何触发器都将被暂停,但如果将触发器添加到组“axx”,则不会暂停,因为在应用“组从一个匹配器开始”时,不知道“axx”。但是,如果存在预先存在的组“aaa”和“bbb”,并且提供了一个匹配器来暂停组“axx”(组等于匹配器),则不会暂停任何触发器,但请记住,组“axx”已暂停,稍后在该组中添加触发器时,它将暂停。
代码示例来源:origin: myschedule/myschedule-quartz-extra
public void pauseTriggers(GroupMatcher<TriggerKey> groupMatcher) {
try {
scheduler.pauseTriggers(groupMatcher);
} catch (SchedulerException e) {
throw new QuartzRuntimeException(e);
}
}
代码示例来源:origin: org.codelibs/elasticsearch-quartz
public void pauseTriggers(final GroupMatcher<TriggerKey> matcher) {
try {
scheduler.pauseTriggers(matcher);
} catch (final SchedulerException e) {
throw new QuartzSchedulerException(e);
}
}
代码示例来源:origin: OpenWiseSolutions/openhub-framework
@Override
public void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException {
getScheduler().pauseTriggers(matcher);
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public void pauseJobs(final String groupName) throws SSchedulerException {
final GroupMatcher<TriggerKey> groupEquals = GroupMatcher.triggerGroupEquals(groupName);
try {
scheduler.pauseTriggers(groupEquals);
} catch (final SchedulerException e) {
throw new SSchedulerException("Unable to put jobs of tenant " + groupName + " in pause", e);
}
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public void pauseJobs(final String groupName) throws SSchedulerException {
final GroupMatcher<TriggerKey> groupEquals = GroupMatcher.triggerGroupEquals(groupName);
try {
scheduler.pauseTriggers(groupEquals);
} catch (final SchedulerException e) {
throw new SSchedulerException("Unable to put jobs of tenant " + groupName + " in pause", e);
}
}
代码示例来源:origin: cdapio/cdap
/**
* Creates a paused group TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP by adding a dummy job to it if it does not exist
* already. This is needed so that we can add new triggers to this paused group and they will be paused too.
*
* @throws org.quartz.SchedulerException
*/
private void initNewPausedTriggersGroup() throws org.quartz.SchedulerException {
// if the dummy job does not already exists in the TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP
// then create a dummy job which will create the TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP
if (!scheduler.checkExists(new JobKey(EmptyJob.class.getSimpleName(), PAUSED_NEW_TRIGGERS_GROUP))) {
JobDetail job = JobBuilder.newJob(EmptyJob.class)
.withIdentity(EmptyJob.class.getSimpleName(), PAUSED_NEW_TRIGGERS_GROUP)
.storeDurably(true)
.build();
scheduler.addJob(job, true);
}
// call pause on this group this ensures that all the new triggers added to this group will also be paused
scheduler.pauseTriggers(GroupMatcher.triggerGroupEquals(PAUSED_NEW_TRIGGERS_GROUP));
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
/**
* Creates a paused group TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP by adding a dummy job to it if it does not exist
* already. This is needed so that we can add new triggers to this paused group and they will be paused too.
*
* @throws org.quartz.SchedulerException
*/
private void initNewPausedTriggersGroup() throws org.quartz.SchedulerException {
// if the dummy job does not already exists in the TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP
// then create a dummy job which will create the TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP
if (!scheduler.checkExists(new JobKey(EmptyJob.class.getSimpleName(), PAUSED_NEW_TRIGGERS_GROUP))) {
JobDetail job = JobBuilder.newJob(EmptyJob.class)
.withIdentity(EmptyJob.class.getSimpleName(), PAUSED_NEW_TRIGGERS_GROUP)
.storeDurably(true)
.build();
scheduler.addJob(job, true);
}
// call pause on this group this ensures that all the new triggers added to this group will also be paused
scheduler.pauseTriggers(GroupMatcher.triggerGroupEquals(PAUSED_NEW_TRIGGERS_GROUP));
}
代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz
@Override
public void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws QuartzException {
try {
delegate.pauseTriggers(matcher);
} catch (SchedulerException e) {
Logger.error(e.getMessage());
throw new QuartzException(e);
}
}
代码示例来源:origin: com.threewks.thundr/thundr-quartz
@Override
public void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws QuartzException {
try {
delegate.pauseTriggers(matcher);
} catch (SchedulerException e) {
Logger.error(e.getMessage());
throw new QuartzException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!