Table of Contents

Interface ISchedulerFactory

Namespace
Quartz
Assembly
Quartz.dll

Provides a mechanism for obtaining client-usable handles to IScheduler instances.

public interface ISchedulerFactory
Extension Methods

Methods

GetAllSchedulers(CancellationToken)

Returns handles to every scheduler in the container this factory belongs to.

ValueTask<List<IScheduler>> GetAllSchedulers(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<List<IScheduler>>

Remarks

A scheduler is only in the repository of the container that built it, so a factory lists its own container's schedulers and nobody else's.

GetScheduler(CancellationToken)

Returns a client-usable handle to the IScheduler this factory produces, building it if it has not been built yet.

ValueTask<IScheduler> GetScheduler(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<IScheduler>

Remarks

Never returns null: a factory is configured to produce exactly one scheduler, so either it can be built or the attempt throws.

LookupScheduler(string, CancellationToken)

Finds the scheduler with the given name, or null when this container has none.

ValueTask<IScheduler?> LookupScheduler(string schedulerName, CancellationToken cancellationToken = default)

Parameters

schedulerName string
cancellationToken CancellationToken

Returns

ValueTask<IScheduler>

Remarks

This is a lookup, which is why it is named for one and why it is nullable while GetScheduler(CancellationToken) is not: any name other than this factory's own belongs to a scheduler somebody else registered, and it may not exist. The comparison ignores case, because that is how the repository indexes names.

A name the container registered is built on demand, whether or not it is this factory's own: what makes a scheduler exist is the registration, so "give me tenant acme" does not depend on whether something else happened to resolve it first. A name added at runtime with ISchedulerRuntime is found while it is alive and not rebuilt after it has been shut down — it has no registration to be rebuilt from, and adding it again is that interface's.

Only schedulers from the same container are visible. A scheduler built by a QuartzSchedulerBuilder of its own is not in this container's repository and is reported as absent.

See Also