public class Breaker<T> extends Object
RxBox.enforce(java.util.function.Function)
calls are causing
a problem during a major change, and you'd like to be able to open the circuit, fix things up,
then close it again to resume operation.
A `Breaker` is an `RxBox` which wraps another `RxBox`. So long as the breaker is closed, calling
`set` on either the `Breaker` or the wrapped box will set both of them.
Once you call `setClosed(false)`, the two boxes are separate. You can still modify the `Breaker`
and its wrapped box, but they will not affect each other.
When you call `setClosed(true)`, the wrapped box will be set to the value of the `Breaker`, and all
future changes will again be synchronized.Modifier and Type | Method and Description |
---|---|
Observable<T> |
asObservable() |
static <T> Breaker<T> |
createClosed(RxBox<T> box)
Creates a `Breaker` which is initially closed.
|
static <T> Breaker<T> |
createOpen(RxBox<T> box)
Creates a `Breaker` which is initially open.
|
T |
get()
Returns the value.
|
void |
set(T newValue)
Sets the value.
|
void |
setClosed(boolean closed)
Sets that this breaker is closed or open.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
combineLatest, from, fromVolatile, map
subscribe, wrap
accept, from, modify, ofVolatile
public void setClosed(boolean closed)
public static <T> Breaker<T> createClosed(RxBox<T> box)
public static <T> Breaker<T> createOpen(RxBox<T> box)
public Observable<T> asObservable()
asObservable
in interface IObservable<T>