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
Modifier and TypeInterfaceDescriptionstatic final class
Creates a builder ofScheduledPollingStrategy.RecurringPolicy
with 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.RecurringPolicy
with 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 void
lengthen()
Allows theScheduledPollingStrategy.RecurringPolicy
to react by prolonging theinterval
between ticking.default void
shorten()
Allows theScheduledPollingStrategy.RecurringPolicy
to react by shortening theinterval
between ticking.
-
Method Details
-
interval
Duration interval()Returns the current interval.- Returns:
- a current interval
-
shorten
default void shorten()Allows theScheduledPollingStrategy.RecurringPolicy
to react by shortening theinterval
between ticking.The default implementation is empty.
-
lengthen
default void lengthen()Allows theScheduledPollingStrategy.RecurringPolicy
to react by prolonging theinterval
between ticking.The default implementation is empty.
-
adaptiveBuilder
static ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder adaptiveBuilder(Duration initialInterval) Creates a builder ofScheduledPollingStrategy.RecurringPolicy
with 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
-