Interface Cron
- All Superinterfaces:
RuntimeType.Api<CronConfig>, Task
Scheduling periodically executed task with specified cron expression.
Cron.builder()
.expression("0 45 9 ? * *")
.task(inv -> System.out.println("Executed every day at 9:45"))
.build();
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic CronConfig.Builderbuilder()Create a new fluent API builder to build a cron task.static Croncreate(CronConfig config) Create a cron task from programmatic configuration.static Croncreate(Consumer<CronConfig.Builder> configConsumer) Create a cron task from configuration.Methods inherited from interface RuntimeType.Api
prototypeModifier and TypeMethodDescriptionThe prototype as it was received when creating this runtime object instance.Methods inherited from interface Task
close, description, enabled, executor, idModifier and TypeMethodDescriptiondefault voidclose()Close the created task.Human-readable description of the task invocation interval.default booleanenabled()If task is enabled or disabled, scheduling tasks are enabled by default and can be disabled programmatically or via configuration.executor()Executorused for invocation of scheduled tasks.default Stringid()ID used to identify this task.
-
Method Details
-
builder
Create a new fluent API builder to build a cron task.- Returns:
- a builder instance
-
create
Create a cron task from configuration.- Parameters:
configConsumer- config consumer- Returns:
- a new cron task configured from config
-
create
Create a cron task from programmatic configuration.- Parameters:
config- configuration- Returns:
- a new cron task
-