DispatchLockContext
class DispatchLockContext
Track dispatch lock ownership until a queue accepts the job.
Properties
| static protected null|LockRecord> | $records | The lock records owned by live dispatch operations. |
|
| static protected list<Closure(): null|Closure(Closure(): void): void> | $releaseContextCallbacks | The callbacks that capture context before dispatch lock acquisition. |
Methods
Register a callback that captures the context needed for deferred lock release.
Capture and compose the current release context.
Register an acquired unique lock.
Register an acquired debounce lock.
Peek at hidden unique-job payload metadata.
Determine whether a dispatch owns any locks.
Delegate a dispatch's lock ownership to a registered callback.
Claim lock ownership in a delegated callback.
Mark a dispatch as accepted by a queue.
Release locks still owned by a dispatch.
Take an independent release snapshot before accepting a dispatch.
Release locks from an independent dispatch snapshot.
Release both owned locks even if one cleanup fails.
Get a dispatch's current lock record.
Set whether a dispatch's lock ownership has been delegated.
Create an empty dispatch lock record.
Flush all static state.
Details
at line 62
static void
captureReleaseContextUsing(callable|null $callback)
Register a callback that captures the context needed for deferred lock release.
Callbacks persist for the worker lifetime and affect subsequent dispatches. Return a wrapper that invokes the release operation once and restores the previous context in finally, or null when no context is needed. The first wrapper is outermost. Passing null clears registrations; capture runs before acquiring a lock.
at line 81
static Closure|null
captureReleaseContext()
| internal |
Capture and compose the current release context.
at line 114
static void
registerUnique(object $job, Repository $cache, string|null $cacheStore, string $key, string $owner, Closure|null $releaseContext = null)
| internal |
Register an acquired unique lock.
at line 144
static void
registerDebounce(object $job, Repository $cache, string $key, string $owner, Closure|null $releaseContext = null)
| internal |
Register an acquired debounce lock.
at line 166
static array|null
peekPayloadMetadata(object $job)
| internal |
Peek at hidden unique-job payload metadata.
at line 176
static bool
has(object $job)
| internal |
Determine whether a dispatch owns any locks.
at line 186
static bool
delegate(object $job)
| internal |
Delegate a dispatch's lock ownership to a registered callback.
at line 196
static bool
claim(object $job)
| internal |
Claim lock ownership in a delegated callback.
at line 206
static void
accept(object $job)
| internal |
Mark a dispatch as accepted by a queue.
at line 220
static void
release(object $job)
| internal |
Release locks still owned by a dispatch.
at line 250
static array|null
snapshot(object $job)
| internal |
Take an independent release snapshot before accepting a dispatch.
at line 272
static void
releaseSnapshot(array $snapshot)
| internal |
Release locks from an independent dispatch snapshot.
at line 290
static protected void
releaseLocks(array $snapshot)
Release both owned locks even if one cleanup fails.
at line 328
static protected array|null
record(object $job)
Get a dispatch's current lock record.
at line 340
static protected bool
setDelegated(object $job, bool $delegated)
Set whether a dispatch's lock ownership has been delegated.
at line 360
static protected array
newRecord()
Create an empty dispatch lock record.
at line 374
static void
flushState()
Flush all static state.