Constructs a new pairing of a job and a schedule.
Constructs a new pairing of a job and a schedule, with the default system time provider.
Gets the id for this scheduled job.
Gets the job from this pairing.
Gets the schedule from this pairing.
Compares two scheduled jobs, such that jobs whose next execution time is earlier, are considered greater than others.
Tests the functionality of comparing two scheduled jobs.
import std.experimental.logger; import scheduled.schedules.one_time; JobSchedule s1 = new OneTimeSchedule(msecs(50)); JobSchedule s2 = new OneTimeSchedule(msecs(500)); JobSchedule s3 = new OneTimeSchedule(msecs(2500)); class IncrementJob : Job { public uint x = 0; public void run() { x++; logf(LogLevel.info, "Incrementing counter to %d.", x); } } auto j = new IncrementJob; ScheduledJob jobA = new ScheduledJob(j, s1, 1); ScheduledJob jobA2 = new ScheduledJob(j, s1, 2); ScheduledJob jobB = new ScheduledJob(j, s2, 3); ScheduledJob jobC = new ScheduledJob(j, s3, 4); assert(jobA > jobB); assert(jobA >= jobA2 && jobA <= jobA2); assert(jobB > jobC); assert(jobA > jobC);
Represents a pairing of a Job with a schedule. This is a component that is utilized internally by Schedulers.