Module io.helidon.config
Package io.helidon.config
Interface ScheduledPollingStrategy.RecurringPolicy
- All Known Implementing Classes:
ScheduledPollingStrategy.RegularRecurringPolicy
- Enclosing class:
ScheduledPollingStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An SPI that allows users to define their own policy how to change the interval between scheduled ticking.
The only needed implementation is of interval(). Methods shorten() and lengthen() might be used
to shorten or to lengthen an interval. Both of them are called from scheduled polling strategy depending on
the result of the polling event (PollingStrategy.Polled.poll(java.time.Instant).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classCreates a builder ofScheduledPollingStrategy.RecurringPolicywith an ability to change the behaviour, with a boundaries and the possibility to react to feedback given byshorten()orlengthen(). -
Method Summary
Modifier and TypeMethodDescriptionadaptiveBuilder(Duration initialInterval) Creates a builder ofScheduledPollingStrategy.RecurringPolicywith an ability to change the behaviour, with a boundaries and the possibility to react to feedback given byshorten()orlengthen().interval()Returns the current interval.default voidlengthen()Allows theScheduledPollingStrategy.RecurringPolicyto react by prolonging theintervalbetween ticking.default voidshorten()Allows theScheduledPollingStrategy.RecurringPolicyto react by shortening theintervalbetween ticking.
-
Method Details
-
interval
Duration interval()Returns the current interval.- Returns:
- a current interval
-
shorten
default void shorten()Allows theScheduledPollingStrategy.RecurringPolicyto react by shortening theintervalbetween ticking.The default implementation is empty.
-
lengthen
default void lengthen()Allows theScheduledPollingStrategy.RecurringPolicyto react by prolonging theintervalbetween ticking.The default implementation is empty.
-
adaptiveBuilder
static ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder adaptiveBuilder(Duration initialInterval) Creates a builder ofScheduledPollingStrategy.RecurringPolicywith an ability to change the behaviour, with a boundaries and the possibility to react to feedback given byshorten()orlengthen().- Parameters:
initialInterval- an initial interval- Returns:
- the new builder
-