T
- return type@Internal public class Retry<T> extends Object
Modifier and Type | Method and Description |
---|---|
io.atlassian.fugue.Either<Exception,T> |
executeOnce()
Run the closure once and don't retry
|
io.atlassian.fugue.Either<Exception,T> |
executeTimes(int times)
Run the closure once and then retry the given number of times.
|
static Retry<com.atlassian.jira.user.anonymize.Retry.NullReturn> |
from(Runnable runnable) |
static <T> Retry<T> |
from(Supplier<T> supplier) |
Retry<T> |
onException(java.util.function.Consumer<Exception> exceptionHandler)
Sets the handler function that will be called every time the
closure throws an exception -- passing that exception as an
argument -- even if there're retries left.
|
Retry<T> |
onFail(java.util.function.Consumer<Exception> failureHandler)
Sets the the handler function that will be called after execution of the closure had
failed and the number of retries is exhausted.
|
Retry<T> |
onSuccess(java.util.function.Consumer<Integer> successHandler)
Sets the function called after successful execution of the
closure.
|
Retry |
rethrowOnFail() |
public static Retry<com.atlassian.jira.user.anonymize.Retry.NullReturn> from(Runnable runnable)
public Retry<T> onException(java.util.function.Consumer<Exception> exceptionHandler)
exceptionHandler
- handler function or null to remove the previous handlerpublic Retry<T> onFail(java.util.function.Consumer<Exception> failureHandler)
failureHandler
- handler function or null to remove the previous handlerpublic Retry<T> onSuccess(java.util.function.Consumer<Integer> successHandler)
successHandler
- handler function or null to remove the previous handlerpublic Retry rethrowOnFail()
public io.atlassian.fugue.Either<Exception,T> executeOnce()
public io.atlassian.fugue.Either<Exception,T> executeTimes(int times)
times
- number of retires. "0" causes the closure to be called only onceCopyright © 2002-2023 Atlassian. All Rights Reserved.