Interface FixedRate
- All Superinterfaces:
RuntimeType.Api<FixedRateConfig>, Task
Scheduling periodically executed task with specified fixed rate.
FixedRate.builder()
.interval(Duration.ofSeconds(2))
.task(inv -> System.out.println("Executed every 2 seconds"))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumWhether the interval of the next invocation should be calculated from the start or end of the previous task. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic FixedRateConfig.Builderbuilder()Create a new fluent API builder to build a fixed rate task.static FixedRatecreate(FixedRateConfig config) Create a fixed rate task from programmatic configuration.static FixedRatecreate(Consumer<FixedRateConfig.Builder> configConsumer) Create a fixed rate 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 fixed rate task.- Returns:
- a builder instance
-
create
Create a fixed rate task from configuration.- Parameters:
configConsumer- config consumer- Returns:
- a new fixed rate task configured from config
-
create
Create a fixed rate task from programmatic configuration.- Parameters:
config- configuration- Returns:
- a new fixed rate task
-