本文整理汇总了C#中GroupMatcher类的典型用法代码示例。如果您正苦于以下问题:C# GroupMatcher类的具体用法?C# GroupMatcher怎么用?C# GroupMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GroupMatcher类属于命名空间,在下文中一共展示了GroupMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResumeTriggers
/// <summary>
/// Resume (un-pause) all of the <see cref="T:Quartz.ITrigger"/>s in matching groups.
/// </summary>
/// <remarks>
/// If any <see cref="T:Quartz.ITrigger"/> missed one or more fire-times, then the
/// <see cref="T:Quartz.ITrigger"/>'s misfire instruction will be applied.
/// </remarks>
/// <seealso cref="M:Quartz.IScheduler.PauseTriggers(Quartz.Impl.Matchers.GroupMatcher{Quartz.TriggerKey})"/>
public void ResumeTriggers(GroupMatcher<TriggerKey> matcher)
{
_scheduler.ResumeTriggers(matcher);
}
示例2: PauseTriggers
/// <summary>
/// Pause all of the <see cref="ITrigger" />s in the given group.
/// <para>
/// 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.
/// </para>
/// </summary>
public virtual Collection.ISet<string> PauseTriggers(GroupMatcher<TriggerKey> matcher)
{
IList<string> pausedGroups;
lock (lockObject)
{
pausedGroups = new List<string>();
StringOperator op = matcher.CompareWithOperator;
if (op == StringOperator.Equality)
{
this.PausedTriggerGroups.Save(
new BsonDocument(
new BsonElement("_id", matcher.CompareToValue)));
pausedGroups.Add(matcher.CompareToValue);
}
else
{
IList<string> groups = this.GetTriggerGroupNames();
foreach (string group in groups)
{
if (op.Evaluate(group, matcher.CompareToValue))
{
this.PausedTriggerGroups.Save(
new BsonDocument(
new BsonElement("_id", matcher.CompareToValue)));
pausedGroups.Add(matcher.CompareToValue);
}
}
}
foreach (string pausedGroup in pausedGroups)
{
Collection.ISet<TriggerKey> keys = this.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEquals(pausedGroup));
foreach (TriggerKey key in keys)
{
this.PauseTrigger(key);
}
}
}
return new Collection.HashSet<string>(pausedGroups);
}
示例3: ResumeTriggers
/// <summary>
/// Resume (un-pause) all of the <see cref="ITrigger" />s in the
/// matching groups.
/// <para>
/// If any <see cref="ITrigger" /> missed one or more fire-times, then the
/// <see cref="ITrigger" />'s misfire instruction will be applied.
/// </para>
/// </summary>
public virtual void ResumeTriggers(GroupMatcher<TriggerKey> matcher)
{
ValidateState();
if (matcher == null)
{
matcher = GroupMatcher<TriggerKey>.GroupEquals(SchedulerConstants.DefaultGroup);
}
ICollection<string> pausedGroups = resources.JobStore.ResumeTriggers(matcher);
NotifySchedulerThread(null);
foreach (string pausedGroup in pausedGroups)
{
NotifySchedulerListenersResumedTriggers(pausedGroup);
}
}
示例4: ResumeTriggers
/// <summary>
/// Resume (un-pause) all of the <see cref="ITrigger" />s in the
/// given group.
/// <para>
/// If any <see cref="ITrigger" /> missed one or more fire-times, then the
/// <see cref="ITrigger" />'s misfire instruction will be applied.
/// </para>
/// </summary>
public virtual IList<string> ResumeTriggers(GroupMatcher<TriggerKey> matcher)
{
Collection.ISet<string> groups = new Collection.HashSet<string>();
lock (lockObject)
{
Collection.ISet<TriggerKey> keys = this.GetTriggerKeys(matcher);
foreach (TriggerKey triggerKey in keys)
{
groups.Add(triggerKey.Group);
IOperableTrigger trigger = this.Triggers.FindOneByIdAs<IOperableTrigger>(triggerKey.ToBsonDocument());
var pausedJobGroup = this.PausedJobGroups.FindOneByIdAs<string>(trigger.JobKey.Group);
if (pausedJobGroup != null)
{
continue;
}
this.ResumeTrigger(triggerKey);
}
foreach (String group in groups)
{
this.PausedTriggerGroups.Remove(
Query.EQ("_id", group));
}
}
return new List<string>(groups);
}
示例5: GetTriggerKeys
/// <summary>
/// Get the names of all of the <see cref="ITrigger" /> s
/// that have the given group name.
/// </summary>
public virtual Collection.ISet<TriggerKey> GetTriggerKeys(GroupMatcher<TriggerKey> matcher)
{
lock (lockObject)
{
var result = this.Triggers
.FindAs<Spi.IOperableTrigger>(
Query.EQ("Group", matcher.CompareToValue))
.Select(t => t.Key);
return new Collection.HashSet<TriggerKey>(result);
}
}
示例6: GetTriggerKeys
/// <summary>
/// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />.
/// </summary>
public virtual Collection.ISet<TriggerKey> GetTriggerKeys(GroupMatcher<TriggerKey> matcher)
{
try
{
return GetRemoteScheduler().GetTriggerKeys(matcher);
}
catch (RemotingException re)
{
throw InvalidateHandleCreateException("Error communicating with remote scheduler.", re);
}
}
示例7: ResumeTriggers
/// <summary>
/// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />.
/// </summary>
public virtual void ResumeTriggers(GroupMatcher<TriggerKey> matcher)
{
try
{
GetRemoteScheduler().ResumeTriggers(matcher);
}
catch (RemotingException re)
{
throw InvalidateHandleCreateException("Error communicating with remote scheduler.", re);
}
}
示例8: ResumeTriggers
/// <summary>
/// Resume (un-pause) all of the <see cref="T:Quartz.ITrigger"/>s
/// in the given group.
/// <para>
/// If any <see cref="T:Quartz.ITrigger"/> missed one or more fire-times, then the
/// <see cref="T:Quartz.ITrigger"/>'s misfire instruction will be applied.
/// </para>
/// </summary>
public override IList<string> ResumeTriggers(GroupMatcher<TriggerKey> matcher)
{
var resumedTriggerGroups = new List<string>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var triggerGroupSetKey =
RedisJobStoreSchema.TriggerGroupSetKey(matcher.CompareToValue);
Db.SetRemove(RedisJobStoreSchema.PausedTriggerGroupsSetKey(), triggerGroupSetKey);
var triggerHashKeysResult = Db.SetMembers(triggerGroupSetKey);
foreach (var triggerHashKey in triggerHashKeysResult)
{
var trigger = RetrieveTrigger(RedisJobStoreSchema.TriggerKey(triggerHashKey));
ResumeTrigger(trigger.Key);
if(!resumedTriggerGroups.Contains(trigger.Key.Group)) {
resumedTriggerGroups.Add(trigger.Key.Group);
}
}
}
else
{
foreach (var triggerGroupSetKy in Db.SetMembersAsync(RedisJobStoreSchema.TriggerGroupsSetKey()).Result)
{
if (matcher.CompareWithOperator.Evaluate(RedisJobStoreSchema.TriggerGroup(triggerGroupSetKy),
matcher.CompareToValue))
{
resumedTriggerGroups.AddRange(ResumeTriggers(GroupMatcher<TriggerKey>.GroupEquals(RedisJobStoreSchema.TriggerGroup(triggerGroupSetKy))));
}
}
}
return resumedTriggerGroups;
}
示例9: TriggerKeys
/// <summary>
/// Get the names of all of the <see cref="T:Quartz.ITrigger"/>s
/// that have the given group name.
/// <para>
/// If there are no triggers in the given group name, the result should be a
/// zero-length array (not <see langword="null"/>).
/// </para>
/// </summary>
public override global::Quartz.Collection.ISet<TriggerKey> TriggerKeys(GroupMatcher<TriggerKey> matcher)
{
var triggerKeys = new global::Quartz.Collection.HashSet<TriggerKey>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var triggerGroupSetKey =
this.RedisJobStoreSchema.TriggerGroupSetKey(matcher.CompareToValue);
var triggers = this.Db.SetMembers(triggerGroupSetKey);
foreach (var trigger in triggers)
{
triggerKeys.Add(this.RedisJobStoreSchema.TriggerKey(trigger));
}
}
else
{
var triggerGroupSets = this.Db.SetMembersAsync(this.RedisJobStoreSchema.TriggerGroupsSetKey()).Result;
var triggerGroupsResult = (from groupSet in triggerGroupSets where matcher.CompareWithOperator.Evaluate(this.RedisJobStoreSchema.TriggerGroup(groupSet), matcher.CompareToValue) select Db.SetMembers(groupSet.ToString())).ToList();
foreach (var triggerHashKeys in triggerGroupsResult)
{
if (triggerHashKeys != null)
{
foreach (var triggerHashKey in triggerHashKeys)
{
triggerKeys.Add(this.RedisJobStoreSchema.TriggerKey(triggerHashKey));
}
}
}
}
return triggerKeys;
}
示例10: PauseTriggers
/// <summary>
/// Pause all of the <see cref="T:Quartz.ITrigger"/>s in the
/// given group.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
public override IList<string> PauseTriggers(GroupMatcher<TriggerKey> matcher)
{
var pausedTriggerGroups = new List<string>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var triggerGroupSetKey = this.RedisJobStoreSchema.TriggerGroupSetKey(matcher.CompareToValue);
var addResult = this.Db.SetAdd(this.RedisJobStoreSchema.PausedTriggerGroupsSetKey(), triggerGroupSetKey);
if (addResult)
{
foreach (var triggerHashKey in this.Db.SetMembers(triggerGroupSetKey))
{
this.PauseTrigger(this.RedisJobStoreSchema.TriggerKey(triggerHashKey));
}
pausedTriggerGroups.Add(this.RedisJobStoreSchema.TriggerGroup(triggerGroupSetKey));
}
}
else
{
var allTriggerGroups = this.Db.SetMembers(this.RedisJobStoreSchema.TriggerGroupsSetKey());
var triggerGroupsResult = allTriggerGroups.Where(groupHashKey => matcher.CompareWithOperator.Evaluate(this.RedisJobStoreSchema.TriggerGroup(groupHashKey), matcher.CompareToValue)).ToDictionary<RedisValue, string, RedisValue[]>(groupHashKey => groupHashKey, groupHashKey => Db.SetMembers(groupHashKey.ToString()));
foreach (var triggerGroup in triggerGroupsResult)
{
var addResult = this.Db.SetAdd(this.RedisJobStoreSchema.PausedTriggerGroupsSetKey(), triggerGroup.Key);
if (addResult)
{
foreach (var triggerHashKey in triggerGroup.Value)
{
this.PauseTrigger(this.RedisJobStoreSchema.TriggerKey(triggerHashKey));
}
pausedTriggerGroups.Add(this.RedisJobStoreSchema.TriggerGroup(triggerGroup.Key));
}
}
}
return pausedTriggerGroups;
}
示例11: ResumeJobs
/// <summary>
/// Resume (un-pause) all of the <see cref="T:Quartz.IJob"/>s in
/// the given group.
/// <para>
/// If any of the <see cref="T:Quartz.IJob"/> s had <see cref="T:Quartz.ITrigger"/> s that
/// missed one or more fire-times, then the <see cref="T:Quartz.ITrigger"/>'s
/// misfire instruction will be applied.
/// </para>
/// </summary>
public override global::Quartz.Collection.ISet<string> ResumeJobs(GroupMatcher<JobKey> matcher)
{
var resumedJobGroups = new List<string>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var jobGroupSetKey = RedisJobStoreSchema.JobGroupSetKey(matcher.CompareToValue);
var removedPausedResult = Db.SetRemove(RedisJobStoreSchema.PausedJobGroupsSetKey(), jobGroupSetKey);
var jobsResult = Db.SetMembers(jobGroupSetKey);
if (removedPausedResult)
{
resumedJobGroups.Add(RedisJobStoreSchema.JobGroup(jobGroupSetKey));
}
foreach (var job in jobsResult)
{
ResumeJob(RedisJobStoreSchema.JobKey(job));
}
}
else
{
foreach (var jobGroupSetKey in Db.SetMembers(RedisJobStoreSchema.JobGroupsSetKey()))
{
if (matcher.CompareWithOperator.Evaluate(RedisJobStoreSchema.JobGroup(jobGroupSetKey),
matcher.CompareToValue))
{
resumedJobGroups.AddRange(ResumeJobs(
GroupMatcher<JobKey>.GroupEquals(RedisJobStoreSchema.JobGroup(jobGroupSetKey))));
}
}
}
return new global::Quartz.Collection.HashSet<string>(resumedJobGroups);
}
示例12: PauseJobs
/// <summary>
/// Pause the <see cref="T:Quartz.IJob"/> with the given key - by
/// pausing all of its current <see cref="T:Quartz.ITrigger"/>s.
/// </summary>
public override IList<string> PauseJobs(GroupMatcher<JobKey> matcher)
{
var pausedJobGroups = new List<string>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var jobGroupSetKey = RedisJobStoreSchema.JobGroupSetKey(matcher.CompareToValue);
if (Db.SetAdd(RedisJobStoreSchema.PausedJobGroupsSetKey(), jobGroupSetKey))
{
pausedJobGroups.Add(RedisJobStoreSchema.JobGroup(jobGroupSetKey));
foreach (RedisValue val in Db.SetMembers(jobGroupSetKey))
{
PauseJob(RedisJobStoreSchema.JobKey(val));
}
}
}
else
{
var jobGroupSets = Db.SetMembers(RedisJobStoreSchema.JobGroupsSetKey());
var jobGroups = jobGroupSets.Where(jobGroupSet => matcher.CompareWithOperator.Evaluate(RedisJobStoreSchema.JobGroup(jobGroupSet), matcher.CompareToValue)).ToDictionary<RedisValue, string, RedisValue[]>(jobGroupSet => jobGroupSet, jobGroupSet => Db.SetMembers(jobGroupSet.ToString()));
foreach (var jobGroup in jobGroups)
{
if (Db.SetAdd(RedisJobStoreSchema.PausedJobGroupsSetKey(), jobGroup.Key))
{
pausedJobGroups.Add(RedisJobStoreSchema.JobGroup(jobGroup.Key));
foreach (var jobHashKey in jobGroup.Value)
{
PauseJob(RedisJobStoreSchema.JobKey(jobHashKey));
}
}
}
}
return pausedJobGroups;
}
示例13: GetScheduledJobDetails
public Collection.ISet<IJobDetail> GetScheduledJobDetails(GroupMatcher<JobKey> matcher)
{
// no locks necessary for read...
return (Collection.ISet<IJobDetail>)ExecuteWithoutLock(conn => GetScheduledJobDetails(conn, matcher));
}
示例14: PauseTriggerGroup
/// <summary>
/// Pause all of the <see cref="ITrigger" />s in the given group.
/// </summary>
public virtual Collection.ISet<string> PauseTriggerGroup(ConnectionAndTransactionHolder conn, GroupMatcher<TriggerKey> matcher)
{
try
{
Delegate.UpdateTriggerGroupStateFromOtherStates(conn, matcher, StatePaused,
StateAcquired, StateWaiting,
StateWaiting);
Delegate.UpdateTriggerGroupStateFromOtherState(conn, matcher, StatePausedBlocked,
StateBlocked);
IList<String> groups = Delegate.SelectTriggerGroups(conn, matcher);
// make sure to account for an exact group match for a group that doesn't yet exist
StringOperator op = matcher.CompareWithOperator;
if (op.Equals(StringOperator.Equality) && !groups.Contains(matcher.CompareToValue))
{
groups.Add(matcher.CompareToValue);
}
foreach (string group in groups)
{
if (!Delegate.IsTriggerGroupPaused(conn, group))
{
Delegate.InsertPausedTriggerGroup(conn, group);
}
}
return new Collection.HashSet<string>(groups);
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't pause trigger group '" + matcher + "': " + e.Message, e);
}
}
示例15: JobKeys
/// <summary>
/// Get the names of all of the <see cref="T:Quartz.IJob"/> s that
/// have the given group name.
/// <para>
/// If there are no jobs in the given group name, the result should be a
/// zero-length array (not <see langword="null"/>).
/// </para>
/// </summary>
/// <param name="matcher"/>
/// <returns/>
public override global::Quartz.Collection.ISet<JobKey> JobKeys(GroupMatcher<JobKey> matcher)
{
var jobKeys = new global::Quartz.Collection.HashSet<JobKey>();
if (matcher.CompareWithOperator.Equals(StringOperator.Equality))
{
var jobGroupSetKey = this.RedisJobStoreSchema.JobGroupSetKey(matcher.CompareToValue);
var jobHashKeys = this.Db.SetMembers(jobGroupSetKey);
if (jobHashKeys != null)
{
foreach (var jobHashKey in jobHashKeys)
{
jobKeys.Add(this.RedisJobStoreSchema.JobKey(jobHashKey));
}
}
}
else
{
var jobGroupSets = this.Db.SetMembers(this.RedisJobStoreSchema.JobGroupsSetKey());
var jobGroupsResult = (from groupSet in jobGroupSets where matcher.CompareWithOperator.Evaluate(this.RedisJobStoreSchema.JobGroup(groupSet), matcher.CompareToValue) select Db.SetMembers(groupSet.ToString())).ToList();
foreach (var jobHashKey in jobGroupsResult.Where(jobHashKeys => jobHashKeys != null).SelectMany(jobHashKeys => jobHashKeys))
{
jobKeys.Add(this.RedisJobStoreSchema.JobKey(jobHashKey));
}
}
return jobKeys;
}