public class BambooCallables extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
BambooCallables.NotThrowing<V> |
static interface |
BambooCallables.Throwing<V,E1 extends Throwable> |
static interface |
BambooCallables.Throwing1<V,E1 extends Throwable> |
static interface |
BambooCallables.Throwing2<V,E1 extends Throwable,E2 extends Throwable> |
static interface |
BambooCallables.ThrowingX<V,E1 extends Throwable,E2 extends Throwable,E3 extends Throwable> |
Modifier and Type | Method and Description |
---|---|
static <V> V |
callUnchecked(Callable<V> callable) |
static <V> BambooCallables.NotThrowing<V> |
notThrowing(BambooCallables.ThrowingX<V,? extends Exception,? extends Exception,? extends Exception> callable)
Returns a wrapped callable which does not throw checked exceptions.
|
static <V> V |
retryOnException(BambooCallables.NotThrowing<V> callable,
Predicate<RuntimeException> exceptionPredicate)
Utility to re-attempt to execute a callable if it fails with a known exception.
|
static <V> V |
retryOnException(BambooCallables.NotThrowing<V> callable,
Predicate<RuntimeException> exceptionPredicate,
int maxRetryCount)
Utility to re-attempt to execute a callable if it fails with a known exception up to maxRetryCount times.
|
static <V,E extends Throwable> |
retryOnException(BambooCallables.Throwing<V,E> callable,
Class<E> exceptionClass)
Utility to re-attempt to execute a callable if it fails with a known exception.
|
public static <V> V callUnchecked(Callable<V> callable)
public static <V> BambooCallables.NotThrowing<V> notThrowing(BambooCallables.ThrowingX<V,? extends Exception,? extends Exception,? extends Exception> callable)
V
- type of returned valuecallable
- throwing callablepublic static <V,E extends Throwable> V retryOnException(BambooCallables.Throwing<V,E> callable, Class<E> exceptionClass) throws E extends Throwable
If the given callable fails with the provided exception class, this method will re-run the callable in attempt to obtain the result again. Subsequent failure will not be handled and the exception will be propagated.
If the callable fails with a different exception than was expected, the actual exception will be re-thrown by this method.
E extends Throwable
public static <V> V retryOnException(BambooCallables.NotThrowing<V> callable, Predicate<RuntimeException> exceptionPredicate)
If the given callable fails with an exception that matches the given predicate, this method will re-run the callable in attempt to obtain the result again. Subsequent failure will not be handled and the exception will be propagated.
If the callable fails with a different exception than was expected, the actual exception will be re-thrown by this method.
public static <V> V retryOnException(BambooCallables.NotThrowing<V> callable, Predicate<RuntimeException> exceptionPredicate, int maxRetryCount)
If the given callable fails with an exception that matches the given predicate, this method will re-run the callable in attempt to obtain the result again. Subsequent failure will not be handled and the exception will be propagated.
If the callable fails with a different exception than was expected, the actual exception will be re-thrown by this method.
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.