public class RobustExecutor<T,R> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RobustExecutor.VoidFunction0
|
Modifier and Type | Field and Description |
---|---|
private int |
maxRetries
|
private List<Class<?>> |
noRetryThrowables
|
private org.apache.spark.api.java.function.Function<T,R> |
onceFunction
|
private int |
retryInterval
|
Constructor and Description |
---|
RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction,
int maxRetries)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction,
int maxRetries,
int retryInterval)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction,
int maxRetries,
int retryInterval,
List<Class<?>> noRetryThrowables)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction,
List<Class<?>> noRetryThrowables)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.Function0<R> onceFunction)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(RobustExecutor.VoidFunction0 onceFunction)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(RobustExecutor.VoidFunction0 onceFunction,
List<Class<?>> noRetryThrowables)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.VoidFunction<T> onceFunction)
Create a RobustExecutor specifying the retrying behaviour.
|
RobustExecutor(org.apache.spark.api.java.function.VoidFunction<T> onceFunction,
List<Class<?>> noRetryThrowables)
Create a RobustExecutor specifying the retrying behaviour.
|
Modifier and Type | Method and Description |
---|---|
R |
execute()
Execute the specified function with no parameter robustly.
|
R |
execute(T param)
Execute the specified function robustly.
|
public RobustExecutor(RobustExecutor.VoidFunction0 onceFunction)
onceFunction
- function to be executed each time.public RobustExecutor(org.apache.spark.api.java.function.VoidFunction<T> onceFunction)
onceFunction
- function to be executed each time.public RobustExecutor(org.apache.spark.api.java.function.Function0<R> onceFunction)
onceFunction
- function to be executed each time.public RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction)
onceFunction
- function to be executed each time.public RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction, int maxRetries)
onceFunction
- function to be executed each time.maxRetries
- max times of retrying.public RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction, int maxRetries, int retryInterval)
onceFunction
- function to be executed each time.maxRetries
- max times of retrying.retryInterval
- interval (ms) between retries.public RobustExecutor(RobustExecutor.VoidFunction0 onceFunction, List<Class<?>> noRetryThrowables)
onceFunction
- function to be executed each time.noRetryThrowables
- exceptions that are not able to be solved by
retrying.
public RobustExecutor(org.apache.spark.api.java.function.VoidFunction<T> onceFunction, List<Class<?>> noRetryThrowables)
onceFunction
- function to be executed each time.noRetryThrowables
- exceptions that are not able to be solved by
retrying.
public RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction, List<Class<?>> noRetryThrowables)
onceFunction
- function to be executed each time.noRetryThrowables
- exceptions that are not able to be solved by
retrying.
public RobustExecutor(org.apache.spark.api.java.function.Function<T,R> onceFunction, int maxRetries, int retryInterval, List<Class<?>> noRetryThrowables)
maxRetries
- max times of retrying.retryInterval
- interval (ms) between retries.noRetryThrowables
- exceptions that are not able to be solved by
retrying.
@Nonnull public R execute() throws Exception
Exception
- On failure
that cannot be handled by retrying.
@Nonnull public R execute(@Nullable T param) throws Exception
Exception
- On failure
that cannot be handled by retrying.