Class ExecutionSlots
- Namespace
- Quartz
- Assembly
- Quartz.dll
A ledger of the execution-group slots still free during one trigger acquisition, created from an ExecutionLimits snapshot by CreateSlots(IReadOnlyCollection<ExecutionGroupInFlight>?).
public sealed class ExecutionSlots
- Inheritance
-
ExecutionSlots
- Inherited Members
Remarks
A job store acquiring triggers asks TryTake(string?, string) for each candidate and skips the ones it refuses. The ledger holds the rule that decides which triggers a node may take — a group's own limit wins, an unlisted named group falls back to OtherGroups, and triggers with no execution group never do — so that a store outside this assembly enforces the same limits as the ones shipped with Quartz rather than reinventing them.
A Cluster limit reaches this ledger already lowered by what the cluster holds in flight, because CreateSlots(IReadOnlyCollection<ExecutionGroupInFlight>?) subtracts the counts the store passed it. Nothing about TryTake(string?, string) changes for one: by the time it is asked, a cluster-scoped group's remaining count is what the whole cluster has left rather than what this node has left, and it counts down the same way.
It is mutable and not thread-safe: one acquisition pass owns one ledger, which is why ExecutionLimits hands out a new one instead of being one. Create a ledger per attempt, because a retried acquisition must start from the limits again rather than from what the failed attempt had already counted down.
Methods
TryGetRemaining(string?, out int?)
Reads how many slots are left for one execution group without taking any.
public bool TryGetRemaining(string? executionGroup, out int? remaining)
Parameters
executionGroupstringThe execution group, or null for triggers that have none.
remainingint?The slots left, or null when the group is unlimited.
Returns
- bool
true when the group is being tracked. false does not mean nothing is left — OtherGroups may still apply to a named group that has not been taken from yet.
TryTake(string?, string)
Takes one slot for a trigger in the given execution group, if the group has one left.
public bool TryTake(string? executionGroup, string triggerGroup)
Parameters
executionGroupstringThe trigger's ExecutionGroup, which may be null.
triggerGroupstringThe trigger's Group, which the limits fall back to when UsesTriggerGroupWhenUnset is on and the trigger carries no execution group. Required rather than optional so that a store cannot silently opt out of the derivation by not passing it.