public class RetryFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Function<A,B> |
create(Function<A,B> function,
int tries)
Decorates a function so that it retries a number of times before being
allowed to fail.
|
static <A,B> Function<A,B> |
create(Function<A,B> function,
int tries,
ExceptionHandler handler)
Decorates a function so that it retries a number of times before being
allowed to fail.
|
static <A,B> Function<A,B> |
create(Function<A,B> function,
int tries,
ExceptionHandler handler,
long backoff)
Decorates a function so that it retries a number of times before being
allowed to fail.
|
static Runnable |
create(Runnable task,
int tries)
Decorates a runnable so that it retries a number of times before being
allowed to fail.
|
static Runnable |
create(Runnable task,
int tries,
ExceptionHandler handler)
Decorates a runnable so that it retries a number of times before being
allowed to fail.
|
static Runnable |
create(Runnable task,
int tries,
ExceptionHandler handler,
long backoff)
Decorates a runnable so that it retries a number of times before being
allowed to fail, backing off exponentially in time.
|
static <A> Supplier<A> |
create(Supplier<A> supplier,
int tries)
Decorates a supplier so that it retries a number of times before being
allowed to fail.
|
static <A> Supplier<A> |
create(Supplier<A> supplier,
int tries,
ExceptionHandler handler)
Decorates a supplier so that it retries a number of times before being
allowed to fail.
|
static <A> Supplier<A> |
create(Supplier<A> supplier,
int tries,
ExceptionHandler handler,
long backoff)
Decorates a supplier so that it retries a number of times before being
allowed to fail, backing-off in time exponentially.
|
public static Runnable create(Runnable task, int tries)
task - which will be wrapped for retrial. It should be idempotent on
failure.tries - the number of times to re-attempt the callpublic static Runnable create(Runnable task, int tries, ExceptionHandler handler)
task - which will be wrapped for retrial. It should be idempotent on
failure.tries - the number of times to re-attempt the callhandler - passed any exceptions that are encounteredpublic static Runnable create(Runnable task, int tries, ExceptionHandler handler, long backoff)
task - which will be wrapped for retrial. It should be idempotent on
failure.tries - the number of times to re-attempt the callhandler - which acts on exceptions thrown by the wrapped supplierbackoff - time to wait in millis each timepublic static <A> Supplier<A> create(Supplier<A> supplier, int tries)
A - The type of the object returned by suppliersupplier - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callpublic static <A> Supplier<A> create(Supplier<A> supplier, int tries, ExceptionHandler handler)
A - The type of the object returned by suppliersupplier - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callhandler - which acts on exceptions thrown by the wrapped supplierpublic static <A> Supplier<A> create(Supplier<A> supplier, int tries, ExceptionHandler handler, long backoff)
A - The type of the object returned by suppliersupplier - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callhandler - which acts on exceptions thrown by the wrapped supplierbackoff - time to wait in millis each timepublic static <A,B> Function<A,B> create(Function<A,B> function, int tries)
A - the type of the parameter the function acceptsB - the type of the result of the function's apply methodfunction - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callpublic static <A,B> Function<A,B> create(Function<A,B> function, int tries, ExceptionHandler handler)
A - the type of the parameter the function acceptsB - the type of the result of the function's apply methodfunction - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callhandler - which acts on exceptions thrown by the wrapped supplierpublic static <A,B> Function<A,B> create(Function<A,B> function, int tries, ExceptionHandler handler, long backoff)
A - the type of the parameter the function acceptsB - the type of the result of the function's apply methodfunction - which will be wrapped for retrial. It should be idempotent
on failure.tries - the number of times to re-attempt the callhandler - which acts on exceptions thrown by the wrapped supplierbackoff - time to wait in millis each timeCopyright © 2017 Atlassian. All rights reserved.