- java.lang.Object
-
- io.helidon.faulttolerance.Retry.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Retry.Builder
addApplyOn(Class<? extends Throwable> clazz)
Add a throwable to be considered a failure.Retry.Builder
addSkipOn(Class<? extends Throwable> clazz)
This throwable will not be considered retriable.Retry.Builder
applyOn(Class<? extends Throwable>... classes)
These throwables will be considered failures, and all other will not.Retry
build()
Build the instance from this builder.Retry.Builder
cancelSource(boolean cancelSource)
Policy to cancel any source stage if the value return byFtHandler.invoke(java.util.function.Supplier<? extends java.util.concurrent.CompletionStage<T>>)
is cancelled.Retry.Builder
config(Config config)
Load all properties for this circuit breaker from configuration.Retry.Builder
name(String name)
A name assigned for debugging, error reporting or configuration purposes.Retry.Builder
overallTimeout(Duration overallTimeout)
Overall timeout.Retry.Builder
retryPolicy(Retry.RetryPolicy policy)
Configure a retry policy to use to calculate delays between retries.Retry.Builder
scheduledExecutor(ScheduledExecutorService scheduledExecutor)
Executor service to schedule retries.Retry.Builder
skipOn(Class<? extends Throwable>... classes)
These throwables will not be considered retriable, all other will.
-
-
-
Method Detail
-
build
public Retry build()
Description copied from interface:Builder
Build the instance from this builder.
-
retryPolicy
public Retry.Builder retryPolicy(Retry.RetryPolicy policy)
Configure a retry policy to use to calculate delays between retries. Defaults to aRetry.JitterRetryPolicy
with 4 calls (initial call + 3 retries), delay of 200 millis and a jitter of 50 millis.- Parameters:
policy
- retry policy- Returns:
- updated builder instance
-
applyOn
@SafeVarargs public final Retry.Builder applyOn(Class<? extends Throwable>... classes)
These throwables will be considered failures, and all other will not.Cannot be combined with
skipOn
.- Parameters:
classes
- to consider failures and trigger a retry- Returns:
- updated builder instance
-
addApplyOn
public Retry.Builder addApplyOn(Class<? extends Throwable> clazz)
Add a throwable to be considered a failure.- Parameters:
clazz
- to consider failure and trigger a retry- Returns:
- updated builder instance
- See Also:
applyOn
-
skipOn
@SafeVarargs public final Retry.Builder skipOn(Class<? extends Throwable>... classes)
These throwables will not be considered retriable, all other will.Cannot be combined with
applyOn
.- Parameters:
classes
- to skip retries- Returns:
- updated builder instance
-
addSkipOn
public Retry.Builder addSkipOn(Class<? extends Throwable> clazz)
This throwable will not be considered retriable.- Parameters:
clazz
- to to skip retries- Returns:
- updated builder instance
-
scheduledExecutor
public Retry.Builder scheduledExecutor(ScheduledExecutorService scheduledExecutor)
Executor service to schedule retries. By default uses an executor configured onFaultTolerance.scheduledExecutor(java.util.function.Supplier)
.- Parameters:
scheduledExecutor
- executor to use- Returns:
- updated builder instance
-
overallTimeout
public Retry.Builder overallTimeout(Duration overallTimeout)
Overall timeout. When overall timeout is reached, execution terminates (even if the retry policy was not exhausted).- Parameters:
overallTimeout
- an overall timeout- Returns:
- updated builder instance
-
name
public Retry.Builder name(String name)
A name assigned for debugging, error reporting or configuration purposes.- Parameters:
name
- the name- Returns:
- updated builder instance
-
cancelSource
public Retry.Builder cancelSource(boolean cancelSource)
Policy to cancel any source stage if the value return byFtHandler.invoke(java.util.function.Supplier<? extends java.util.concurrent.CompletionStage<T>>)
is cancelled. Default istrue
; mostly used by FT MP to change default.- Parameters:
cancelSource
- cancel source policy- Returns:
- updated builder instance
-
config
public Retry.Builder config(Config config)
Load all properties for this circuit breaker from configuration.
Configuration key default value description overall-timeout 1 second Timeout for overall execution name Retry-N Name used for debugging cancel-source true Cancel task source if task is cancelled delaying-retry-policy N/A A delaying retry policy jitter-retry-policy Policy of 4 calls, delay 200 millis and jitter of 50 millis A jitter retry policy - Parameters:
config
- the config node to use- Returns:
- updated builder instance
-
-