| Modifier and Type | Method and Description |
|---|---|
void |
close()
Doesn't have to be called, added for good measure.
|
boolean |
compareAndTransition(S expectedState,
S newState)
If the expected state is in place the new one is applied and consumers notified.
|
static <S> SingleStateful<S> |
fromInitial(S initialState)
Creates a new stateful component with an initial state.
|
static <S> SingleStateful<S> |
fromInitial(S initialState,
BiConsumer<S,S> beforeTransitionCallback)
Creates a new stateful component with an initial state.
|
S |
state()
Returns the current state of the stateful component.
|
Flux<S> |
states()
Returns a stream of states for this component as they change.
|
void |
transition(S newState)
Transition into a new state, notifying consumers.
|
public static <S> SingleStateful<S> fromInitial(S initialState)
initialState - the initial state of the component.public static <S> SingleStateful<S> fromInitial(S initialState, BiConsumer<S,S> beforeTransitionCallback)
initialState - the initial state of the component.public S state()
Statefulpublic Flux<S> states()
Statefulpublic void transition(S newState)
Note that if the new state is identical to the old state no transition will be performed.
newState - the new state to apply.public boolean compareAndTransition(S expectedState, S newState)
expectedState - the old expected state.newState - the new state to apply.public void close()
Copyright © 2024 Couchbase, Inc.. All rights reserved.