public final class AlwaysStandbyPrimarySelector extends Object implements PrimarySelector
PrimarySelector.Factory
Constructor and Description |
---|
AlwaysStandbyPrimarySelector() |
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.
|
void |
start(InetSocketAddress localAddress)
Starts the primary selector.
|
void |
stop()
Stops the primary selector.
|
void |
waitForState(NodeState state)
Blocks until the primary selector enters the specified state.
|
public void start(InetSocketAddress localAddress)
PrimarySelector
start
in interface PrimarySelector
localAddress
- the address of the local masterpublic void stop()
PrimarySelector
stop
in interface PrimarySelector
public NodeState getState()
getState
in interface PrimarySelector
public NodeState getStateUnsafe()
getStateUnsafe
in interface PrimarySelector
public Scoped onStateChange(java.util.function.Consumer<NodeState> listener)
PrimarySelector
onStateChange
in interface PrimarySelector
listener
- the listenerpublic void waitForState(NodeState state) throws InterruptedException
PrimarySelector
waitForState
in interface PrimarySelector
state
- the state to wait forInterruptedException
Copyright © 2023. All Rights Reserved.