Module io.helidon.config
Package io.helidon.config
Class ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
java.lang.Object
io.helidon.config.ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
- Enclosing interface:
ScheduledPollingStrategy.RecurringPolicy
Creates a builder of
ScheduledPollingStrategy.RecurringPolicy with an ability to change the behaviour, with a boundaries and
the possibility to react to feedback given by ScheduledPollingStrategy.RecurringPolicy.shorten() or ScheduledPollingStrategy.RecurringPolicy.lengthen().-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new recurring policy.lengthen(BiFunction<Duration, Integer, Duration> lengthenFunction) Sets the function that will be used to lengthen the interval between ticking.Sets the maximal interval between tick events.Sets the minimal interval between tick events.shorten(BiFunction<Duration, Integer, Duration> shortenFunction) Sets the function that will be used to shorten the interval between ticking.
-
Method Details
-
min
Sets the minimal interval between tick events.The default value is tenth of
initialInterval.- Parameters:
min- a minimal interval- Returns:
- a modified builder instance
-
max
Sets the maximal interval between tick events.The default value is five times
initialInterval.- Parameters:
max- a minimal interval- Returns:
- a modified builder instance
-
shorten
public ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder shorten(BiFunction<Duration, Integer, Duration> shortenFunction) Sets the function that will be used to shorten the interval between ticking.- Parameters:
shortenFunction- a function that shorts the interval- Returns:
- a modified builder instance
-
lengthen
public ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder lengthen(BiFunction<Duration, Integer, Duration> lengthenFunction) Sets the function that will be used to lengthen the interval between ticking.- Parameters:
lengthenFunction- a function that prolongs the interval- Returns:
- a modified builder instance
-
build
Builds a new recurring policy.- Returns:
- the new instance
-