java.lang.Object
com.aoapps.cron.CronDaemon
Run cron jobs based on their scheduling requirements. Once per minute
it polls each cron job and runs it if it is currently scheduled.
If this main task is delayed for more than a minute, schedules will be missed.
Some possible causes include the process was stopped (kill -STOP
)
or the machine was suspended/hibernated.
- Author:
- AO Industries, Inc.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addCronJob
(CronJob job, Logger logger) Adds aCronJob
to the list of jobs.static void
removeCronJob
(CronJob job) Removes aCronJob
from the list of jobs.static void
runImmediately
(CronJob job) Runs a CronJob immediately if it is not already running or allows concurrent execution.static void
Sets the logger for the cron daemon errors (not the individual cron jobs).
-
Method Details
-
setLogger
Sets the logger for the cron daemon errors (not the individual cron jobs).- Parameters:
logger
- The logger ornull
to use the default logger
-
addCronJob
Adds aCronJob
to the list of jobs. If the job is already in the list, it will not be added again. -
removeCronJob
Removes aCronJob
from the list of jobs. -
runImmediately
Runs a CronJob immediately if it is not already running or allows concurrent execution.- Throws:
IllegalStateException
- If the job has not been added.
-