JobScheduler

A scheduler is the core component of the library; you add jobs to the job scheduler, and then it will execute these according to the job's schedule.

Members

Functions

addCronJob
ScheduledJob addCronJob(Job job, string cronExpressionString)

Adds a job to the scheduler, whose schedule is defined by the given cron expression string.

addCronJob
ScheduledJob addCronJob(void function() fn, string cronExpressionString)

Adds a job to the scheduler, whose schedule is defined by the given cron expression string.

addJob
ScheduledJob addJob(Job job, JobSchedule schedule)

Adds a job to the scheduler, with the given schedule to define when it should be run.

addJob
ScheduledJob addJob(void function() fn, JobSchedule schedule)

Adds a simple job that executes the given function according to the given schedule.

addScheduledJob
void addScheduledJob(ScheduledJob job)

Adds a job to the scheduler.

getNextScheduledJobId
ulong getNextScheduledJobId()

Gets the next available id to assign to a scheduled job. This must be unique among all jobs that have been added to the scheduler but not yet removed.

getTimeProvider
CurrentTimeProvider getTimeProvider()

Gets this scheduler's time provider.

start
void start()

Starts the scheduler. Once started, there is no guarantee that all scheduler implementations will allow adding new jobs while running.

stop
void stop(bool force)

Stops the scheduler. This method blocks until shutdown is complete.

stop
void stop()

Stops the scheduler, and waits for any currently-executing jobs to finish. Equivalent to calling stop(false).

Static functions

getDefault
JobScheduler getDefault()

Gets a default job scheduler that's recommended to use for most cases.

Meta