public class RetryingOperationRunner extends DefaultOperationRunner
Constructor and Description |
---|
RetryingOperationRunner(int maxRetries)
Creates a new runner
|
Modifier and Type | Method and Description |
---|---|
<T extends Options> |
run(Runner<T> runner,
T options,
Operation op)
Runs the operation returning the statistics as an
OperationRun |
protected <T extends Options> |
shouldRetry(Runner<T> runner,
T options,
Operation op,
OperationRun run)
Decides whether the runner should continue retrying
|
public RetryingOperationRunner(int maxRetries)
maxRetries
- Maximum number of retries, a value of 0 means no retries in
which case behaviour is equivalent to the base class
DefaultOperationRunner
public <T extends Options> OperationRun run(Runner<T> runner, T options, Operation op)
OperationRunner
OperationRun
Implementations are also expected to record the information within their
the OperationStats
object of the provided Operation
instance prior to returning the statistics.
run
in interface OperationRunner
run
in class DefaultOperationRunner
runner
- Runneroptions
- Optionsop
- Operation to runprotected <T extends Options> boolean shouldRetry(Runner<T> runner, T options, Operation op, OperationRun run)
The default implementation always returns true
but derived
implementations may want to override this if they only wish to carry out
retries under certain circumstances.
runner
- Runneroptions
- Optionsop
- Operationrun
- Results of the most recent failed runCopyright © 2015. All rights reserved.