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.
@FunctionalInterface public static interface ScheduledPollingStrategy.RecurringPolicy
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()
. Methodsshorten()
andlengthen()
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 Classes Modifier and Type Interface Description static class
ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
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
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description 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()
.Duration
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 Detail
-
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
-
-