S - self typeR - result typepublic abstract class DelayablePolicy<S,R> extends FailurePolicy<S,R>
| Constructor and Description |
|---|
DelayablePolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected Duration |
computeDelay(ExecutionContext context)
Returns a computed delay for the
result and context else null if no delay function is
configured or the computed delay is invalid. |
DelayFunction<R,? extends Throwable> |
getDelayFn()
Returns the function that determines the next delay before allowing another execution.
|
S |
withDelay(DelayFunction<R,? extends Throwable> delayFunction)
Sets the
delayFunction that computes the next delay before allowing another execution. |
<F extends Throwable> |
withDelayOn(DelayFunction<R,F> delayFunction,
Class<F> failure)
Sets the
delayFunction that computes the next delay before allowing another execution. |
S |
withDelayWhen(DelayFunction<R,? extends Throwable> delayFunction,
R result)
Sets the
delayFunction that computes the next delay before allowing another execution. |
handle, handle, handle, handleIf, handleIf, handleResult, handleResultIf, isFailureonFailure, onSuccessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoExecutorpublic DelayFunction<R,? extends Throwable> getDelayFn()
public S withDelay(DelayFunction<R,? extends Throwable> delayFunction)
delayFunction that computes the next delay before allowing another execution.delayFunction - the function to use to compute the delay before a next attemptNullPointerException - if delayFunction is nullDelayFunctionpublic <F extends Throwable> S withDelayOn(DelayFunction<R,F> delayFunction, Class<F> failure)
delayFunction that computes the next delay before allowing another execution. Delays will only
occur for failures that are assignable from the failure.F - failure typedelayFunction - the function to use to compute the delay before a next attemptfailure - the execution failure that is expected in order to trigger the delayNullPointerException - if delayFunction or failure are nullDelayFunctionpublic S withDelayWhen(DelayFunction<R,? extends Throwable> delayFunction, R result)
delayFunction that computes the next delay before allowing another execution. Delays will only
occur for results that equal the result.delayFunction - the function to use to compute the delay before a next attemptresult - the execution result that is expected in order to trigger the delayNullPointerException - if delayFunction or result are nullDelayFunctionprotected Duration computeDelay(ExecutionContext context)
result and context else null if no delay function is
configured or the computed delay is invalid.Copyright © 2021. All rights reserved.