public interface Breaker
| Modifier and Type | Method and Description |
|---|---|
State |
getState() |
static void |
NoOp() |
void |
tryDo(Runnable tryIfAlive)
Do something, unless the breaker is in a broken state, in which case do nothing.
|
void |
tryDo(Runnable tryIfAlive,
Runnable runIfBroken)
Do something, unless the breaker is in a broken state, in which case perform a fallback action.
|
void |
tryDo(Runnable tryIfAlive,
Runnable runOnFirstFailure,
Runnable runIfBroken)
Do something, unless the breaker is in a broken state, in which case perform a fallback action.
|
<T> Optional<T> |
tryGet(Callable<T> tryIfAlive)
Get the result of something, unless the breaker is in a broken state, in which case get a fallback value.
|
<T> T |
tryGet(Callable<T> tryIfAlive,
Runnable runOnFirstFailure,
Supplier<T> getIfBroken)
Get the result of something, unless the breaker is in a broken state, in which case get a fallback value.
|
<T> T |
tryGet(Callable<T> tryIfAlive,
Supplier<T> getIfBroken)
Get the result of something, unless the breaker is in a broken state, in which case get a fallback value.
|
void tryDo(Runnable tryIfAlive, Runnable runOnFirstFailure, Runnable runIfBroken)
tryIfAlive - A runnable, to be invoked unless the breaker is in `BROKEN` staterunOnFirstFailure - A runnable, to be invoked immediately if the first runnable failsrunIfBroken - A runnable, to be invoked if the breaker is in `BROKEN` statevoid tryDo(Runnable tryIfAlive, Runnable runIfBroken)
tryIfAlive - A runnable, to be invoked unless the breaker is in `BROKEN` staterunIfBroken - A runnable, to be invoked if the breaker is in `BROKEN` statevoid tryDo(Runnable tryIfAlive)
tryIfAlive - A runnable, to be invoked unless the breaker is in `BROKEN` state<T> T tryGet(Callable<T> tryIfAlive, Runnable runOnFirstFailure, Supplier<T> getIfBroken)
T - The type to be returned by the `tryIfAlive` callable and `getIfBroken` suppliertryIfAlive - A callable, to be called unless the breaker is in `BROKEN` state. May throw a checked exception.runOnFirstFailure - A runnable, to be invoked immediately if the first callable failsgetIfBroken - A supplier, to be invoked if the breaker is in `BROKEN` state. May not throw a checked exception.<T> T tryGet(Callable<T> tryIfAlive, Supplier<T> getIfBroken)
T - The type to be returned by the `tryIfAlive` callable and `getIfBroken` suppliertryIfAlive - A callable, to be called unless the breaker is in `BROKEN` state. May throw a checked exception.getIfBroken - A supplier, to be invoked if the breaker is in `BROKEN` state. May not throw a checked exception.<T> Optional<T> tryGet(Callable<T> tryIfAlive)
T - The type to be returned by the `tryIfAlive` callable and `getIfBroken` suppliertryIfAlive - A callable, to be called unless the breaker is in `BROKEN` state. May throw a checked exception.State getState()
static void NoOp()
Copyright © 2019. All rights reserved.