@ThreadSafe public abstract class AbstractPrimarySelector extends Object implements PrimarySelector
setState(NodeState)
when they detect a state change. The selector starts off in STANDBY
state.PrimarySelector.Factory
Constructor and Description |
---|
AbstractPrimarySelector() |
Modifier and Type | Method and Description |
---|---|
NodeState |
getState() |
NodeState |
getStateUnsafe() |
Scoped |
onStateChange(java.util.function.Consumer<NodeState> listener)
Registers a listener to be executed whenever the selector's state updates.
|
protected void |
setState(NodeState state) |
void |
waitForState(NodeState state)
Blocks until the primary selector enters the specified state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
start, stop
protected final void setState(NodeState state)
public final NodeState getState()
getState
in interface PrimarySelector
public final NodeState getStateUnsafe()
getStateUnsafe
in interface PrimarySelector
public final Scoped onStateChange(java.util.function.Consumer<NodeState> listener)
PrimarySelector
onStateChange
in interface PrimarySelector
listener
- the listenerpublic final void waitForState(NodeState state) throws InterruptedException
PrimarySelector
waitForState
in interface PrimarySelector
state
- the state to wait forInterruptedException
Copyright © 2023. All Rights Reserved.