Package dev.relism.flash.ext.scheduler
Class Scheduler
java.lang.Object
dev.relism.flash.ext.scheduler.Scheduler
Runs background jobs on an interval or a cron expression.
Scheduler jobs = ctx.require(Scheduler.class);
jobs.every(Duration.ofMinutes(5), reports::refresh);
jobs.cron("0 0 3 * * *", archive::sweep);
One platform thread keeps time; every job body runs on a virtual thread, so a slow job blocks nothing but itself.
Overlapping runs are skipped, always. Not an option — two copies of the same job running at once is a bug in every case anyone has needed so far, and a flag would only let it be configured wrongly. A skipped run is logged at WARN with how long the previous one has been going.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRunsworkon a cron schedule.voidRunsworkon a cron schedule under an explicit name.voidRunsworkeveryintervalunder an explicit name, used in logs.voidRunsworkeveryinterval, starting one interval from now.jobNames()Job names in registration order — for a health or ops endpoint.
-
Method Details
-
every
Runsworkeveryinterval, starting one interval from now. -
every
Runsworkeveryintervalunder an explicit name, used in logs. -
cron
Runsworkon a cron schedule. The expression is validated now, not at fire time. -
cron
Runsworkon a cron schedule under an explicit name. -
jobNames
Job names in registration order — for a health or ops endpoint.
-