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
public static final class ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder extends Object
Creates a builder ofScheduledPollingStrategy.RecurringPolicy
with an ability to change the behaviour, with a boundaries and the possibility to react to feedback given byScheduledPollingStrategy.RecurringPolicy.shorten()
orScheduledPollingStrategy.RecurringPolicy.lengthen()
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScheduledPollingStrategy.RecurringPolicy
build()
Builds a new recurring policy.ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
lengthen(BiFunction<Duration,Integer,Duration> lengthenFunction)
Sets the function that will be used to lengthen the interval between ticking.ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
max(Duration max)
Sets the maximal interval between tick events.ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
min(Duration min)
Sets the minimal interval between tick events.ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder
shorten(BiFunction<Duration,Integer,Duration> shortenFunction)
Sets the function that will be used to shorten the interval between ticking.
-
-
-
Method Detail
-
min
public ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder min(Duration 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
public ScheduledPollingStrategy.RecurringPolicy.AdaptiveBuilder max(Duration 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
public ScheduledPollingStrategy.RecurringPolicy build()
Builds a new recurring policy.- Returns:
- the new instance
-
-