项目:lams
文件:DefaultClusteredJobStore.java
/**
* <p>
* Pause all of the <code>{@link Trigger}s</code> in the given group.
* </p>
* <p>
* The JobStore should "remember" that the group is paused,and impose the pause on any new triggers that are added to
* the group while the group is paused.
* </p>
*/
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException {
HashSet<String> pausedGroups = new HashSet<String>();
lock();
try {
Set<TriggerKey> triggerKeys = getTriggerKeys(matcher);
for (TriggerKey key : triggerKeys) {
triggerFacade.addPausedGroup(key.getGroup());
pausedGroups.add(key.getGroup());
pauseTrigger(key);
}
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS)) {
triggerFacade.addPausedGroup(matcher.getCompareTovalue());
pausedGroups.add(matcher.getCompareTovalue());
}
} finally {
unlock();
}
return pausedGroups;
}
项目:lams
文件:DefaultClusteredJobStore.java
/**
* <p>
* Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the given group - by pausing all of their
* <code>Trigger</code>s.
* </p>
* <p>
* The JobStore should "remember" that the group is paused,and impose the pause on any new jobs that are added to the
* group while the group is paused.
* </p>
*/
@Override
public Collection<String> pauseJobs(GroupMatcher<JobKey> matcher) throws JobPersistenceException {
Collection<String> pausedGroups = new HashSet<String>();
lock();
try {
Set<JobKey> jobKeys = getJobKeys(matcher);
for (JobKey jobKey : jobKeys) {
for (OperableTrigger trigger : getTriggersForJob(jobKey)) {
pauseTrigger(trigger.getKey());
}
pausedGroups.add(jobKey.getGroup());
}
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS)) {
jobFacade.addPausedGroup(matcher.getCompareTovalue());
pausedGroups.add(matcher.getCompareTovalue());
}
} finally {
unlock();
}
return pausedGroups;
}
项目:lams
文件:RAMJobStore.java
/**
* <p>
* Pause all of the kNown <code>{@link Trigger}s</code> matching.
* </p>
*
* <p>
* The JobStore should "remember" the groups paused,and impose the
* pause on any new triggers that are added to one of these groups while the group is
* paused.
* </p>
*
*/
public List<String> pauseTriggers(GroupMatcher<TriggerKey> matcher) {
List<String> pausedGroups;
synchronized (lock) {
pausedGroups = new LinkedList<String>();
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
switch (operator) {
case EQUALS:
if(pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(matcher.getCompareTovalue());
}
break;
default :
for (String group : triggersByGroup.keySet()) {
if(operator.evaluate(group,matcher.getCompareTovalue())) {
if(pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(group);
}
}
}
}
for (String pausedGroup : pausedGroups) {
Set<TriggerKey> keys = getTriggerKeys(GroupMatcher.triggerGroupEquals(pausedGroup));
for (TriggerKey key: keys) {
pauseTrigger(key);
}
}
}
return pausedGroups;
}
项目:lams
文件:RAMJobStore.java
/**
* <p>
* Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the
* given group - by pausing all of their <code>Trigger</code>s.
* </p>
*
*
* <p>
* The JobStore should "remember" that the group is paused,and impose the
* pause on any new jobs that are added to the group while the group is
* paused.
* </p>
*/
public List<String> pauseJobs(GroupMatcher<JobKey> matcher) {
List<String> pausedGroups = new LinkedList<String>();
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedJobGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(matcher.getCompareTovalue());
}
break;
default :
for (String group : jobsByGroup.keySet()) {
if(operator.evaluate(group,matcher.getCompareTovalue())) {
if (pausedJobGroups.add(group)) {
pausedGroups.add(group);
}
}
}
}
for (String groupName : pausedGroups) {
for (JobKey jobKey: getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
List<OperableTrigger> triggersOfJob = getTriggersForJob(jobKey);
for (OperableTrigger trigger: triggersOfJob) {
pauseTrigger(trigger.getKey());
}
}
}
}
return pausedGroups;
}
项目:lams
文件:RemoteMBeanScheduler.java
/**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,* passing the <code>SchedulingContext</code> associated with this
* instance.
* </p>
*/
@SuppressWarnings("unchecked")
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws SchedulerException {
if (matcher.getCompareWithOperator().equals(StringMatcher.StringOperatorName.EQUALS)) {
List<JobKey> keys = (List<JobKey>)invoke(
"getJobNames",new Object[] { matcher.getCompareTovalue() },new String[] { String.class.getName() });
return new HashSet<JobKey>(keys);
} else {
throw new SchedulerException("Only equals matcher are supported for looking up JobKeys");
}
}
项目:lams
文件:JobStoreSupport.java
/**
* <p>
* Pause all of the <code>{@link org.quartz.Trigger}s</code> matching the
* given groupMatcher.
* </p>
*
* @see #resumeTriggerGroup(java.sql.Connection,org.quartz.impl.matchers.GroupMatcher)
*/
public Set<String> pauseTriggerGroup(Connection conn,GroupMatcher<TriggerKey> matcher) throws JobPersistenceException {
try {
getDelegate().updateTriggerGroupStateFromOtherStates(
conn,matcher,STATE_PAUSED,STATE_ACQUIRED,STATE_WAITING,STATE_WAITING);
getDelegate().updateTriggerGroupStateFromOtherState(
conn,STATE_PAUSED_BLOCKED,STATE_BLOCKED);
List<String> groups = getDelegate().selectTriggerGroups(conn,matcher);
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS) && !groups.contains(matcher.getCompareTovalue())) {
groups.add(matcher.getCompareTovalue());
}
for (String group : groups) {
if (!getDelegate().isTriggerGroupPaused(conn,group)) {
getDelegate().insertPausedTriggerGroup(conn,group);
}
}
return new HashSet<String>(groups);
} catch (sqlException e) {
throw new JobPersistenceException("Couldn't pause trigger group '"
+ matcher + "': " + e.getMessage(),e);
}
}
项目:quartz-scheduler-hazelcast-jobstore
文件:HazelcastJobStore.java
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher)
throws JobPersistenceException {
List<String> pausedGroups = new LinkedList<>();
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(matcher.getCompareTovalue());
}
break;
default:
for (String group : triggersByGroup.keySet()) {
if (operator.evaluate(group,matcher.getCompareTovalue())) {
if (pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(group);
}
}
}
}
for (String pausedGroup : pausedGroups) {
Set<TriggerKey> keys = getTriggerKeys(GroupMatcher.triggerGroupEquals(pausedGroup));
for (TriggerKey key : keys) {
pauseTrigger(key);
}
}
return pausedGroups;
}
项目:quartz-scheduler-hazelcast-jobstore
文件:HazelcastJobStore.java
@Override
public Collection<String> pauseJobs(GroupMatcher<JobKey> groupMatcher)
throws JobPersistenceException {
List<String> pausedGroups = new LinkedList<>();
StringMatcher.StringOperatorName operator = groupMatcher
.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedJobGroups.add(groupMatcher.getCompareTovalue())) {
pausedGroups.add(groupMatcher.getCompareTovalue());
}
break;
default:
for (String jobGroup : jobsByGroup.keySet()) {
if (operator.evaluate(jobGroup,groupMatcher.getCompareTovalue())) {
if (pausedJobGroups.add(jobGroup)) {
pausedGroups.add(jobGroup);
}
}
}
}
for (String groupName : pausedGroups) {
for (JobKey jobKey : getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
pauseJob(jobKey);
}
}
return pausedGroups;
}
项目:quartz-hazelcast-jobstore
文件:HazelcastJobStore.java
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher)
throws JobPersistenceException {
List<String> pausedGroups = new LinkedList<>();
StringMatcher.StringOperatorName operator = matcher
.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(matcher.getCompareTovalue());
}
break;
default:
for (String group : triggersByGroup.keySet()) {
if (operator.evaluate(group,matcher.getCompareTovalue())) {
if (pausedTriggerGroups.add(matcher.getCompareTovalue())) {
pausedGroups.add(group);
}
}
}
}
for (String pausedGroup : pausedGroups) {
Set<TriggerKey> keys = getTriggerKeys(GroupMatcher
.triggerGroupEquals(pausedGroup));
for (TriggerKey key : keys) {
pauseTrigger(key);
}
}
return pausedGroups;
}
项目:quartz-hazelcast-jobstore
文件:HazelcastJobStore.java
@Override
public Collection<String> pauseJobs(GroupMatcher<JobKey> groupMatcher)
throws JobPersistenceException {
List<String> pausedGroups = new LinkedList<>();
StringMatcher.StringOperatorName operator = groupMatcher
.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedJobGroups.add(groupMatcher.getCompareTovalue())) {
pausedGroups.add(groupMatcher.getCompareTovalue());
}
break;
default:
for (String jobGroup : jobsByGroup.keySet()) {
if (operator.evaluate(jobGroup,groupMatcher.getCompareTovalue())) {
if (pausedJobGroups.add(jobGroup)) {
pausedGroups.add(jobGroup);
}
}
}
}
for (String groupName : pausedGroups) {
for (JobKey jobKey : getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
pauseJob(jobKey);
}
}
return pausedGroups;
}
项目:lams
文件:RAMJobStore.java
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Job}</code> s that
* match the given groupMatcher.
* </p>
*/
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) {
Set<JobKey> outList = null;
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
String compareTovalue = matcher.getCompareTovalue();
switch(operator) {
case EQUALS:
HashMap<JobKey,JobWrapper> grpMap = jobsByGroup.get(compareTovalue);
if (grpMap != null) {
outList = new HashSet<JobKey>();
for (JobWrapper jw : grpMap.values()) {
if (jw != null) {
outList.add(jw.jobDetail.getKey());
}
}
}
break;
default:
for (Map.Entry<String,HashMap<JobKey,JobWrapper>> entry : jobsByGroup.entrySet()) {
if(operator.evaluate(entry.getKey(),compareTovalue) && entry.getValue() != null) {
if(outList == null) {
outList = new HashSet<JobKey>();
}
for (JobWrapper jobWrapper : entry.getValue().values()) {
if(jobWrapper != null) {
outList.add(jobWrapper.jobDetail.getKey());
}
}
}
}
}
}
return outList == null ? java.util.Collections.<JobKey>emptySet() : outList;
}
项目:lams
文件:RAMJobStore.java
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Trigger}</code> s
* that match the given groupMatcher.
* </p>
*/
public Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) {
Set<TriggerKey> outList = null;
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
String compareTovalue = matcher.getCompareTovalue();
switch(operator) {
case EQUALS:
HashMap<TriggerKey,TriggerWrapper> grpMap = triggersByGroup.get(compareTovalue);
if (grpMap != null) {
outList = new HashSet<TriggerKey>();
for (TriggerWrapper tw : grpMap.values()) {
if (tw != null) {
outList.add(tw.trigger.getKey());
}
}
}
break;
default:
for (Map.Entry<String,HashMap<TriggerKey,TriggerWrapper>> entry : triggersByGroup.entrySet()) {
if(operator.evaluate(entry.getKey(),compareTovalue) && entry.getValue() != null) {
if(outList == null) {
outList = new HashSet<TriggerKey>();
}
for (TriggerWrapper triggerWrapper : entry.getValue().values()) {
if(triggerWrapper != null) {
outList.add(triggerWrapper.trigger.getKey());
}
}
}
}
}
}
return outList == null ? Collections.<TriggerKey>emptySet() : outList;
}
项目:lams
文件:StdJDBCDelegate.java
protected boolean isMatcherEquals(final GroupMatcher<?> matcher) {
return matcher.getCompareWithOperator().equals(StringMatcher.StringOperatorName.EQUALS);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。