@ThreadSafe public class BrokerAdditionStateManager extends Object implements BrokerAdditionCallback
initialize()
MUST be called on any state manager instance before it can be utilized.Constructor and Description |
---|
BrokerAdditionStateManager(int brokerId,
SingleBrokerBalancerOperationProgressListener<BrokerAdditionStateMachine.BrokerAdditionState> progressListener,
SingleBrokerBalancerOperationTerminationListener<BrokerAdditionStateMachine.BrokerAdditionState> terminationListener,
AtomicReference<String> stateMetricReference,
org.apache.kafka.common.utils.Time time) |
Modifier and Type | Method and Description |
---|---|
int |
brokerId() |
long |
creationTimeMs() |
BrokerAdditionStateMachine.BrokerAdditionState |
currentState() |
Optional<Exception> |
exception() |
void |
initialize()
Initialize the #
BrokerAdditionStateManager by setting the current state
and notify the listener if it's the initial addition state |
boolean |
isAtATerminalState()
Returns a boolean indicating whether the current state is terminal.
|
boolean |
isInitialized() |
long |
lastUpdateTimeMs()
The last time the state was updated
|
void |
registerEvent(BrokerAdditionStateMachine.BrokerAdditionEvent event)
Registers a new #
BalancerOperationEvent as part of the progress changing |
void |
registerEvent(BrokerAdditionStateMachine.BrokerAdditionEvent event,
Exception e)
Registers a new errorful #
BalancerOperationEvent as part of the progress changing |
public BrokerAdditionStateManager(int brokerId, SingleBrokerBalancerOperationProgressListener<BrokerAdditionStateMachine.BrokerAdditionState> progressListener, SingleBrokerBalancerOperationTerminationListener<BrokerAdditionStateMachine.BrokerAdditionState> terminationListener, AtomicReference<String> stateMetricReference, org.apache.kafka.common.utils.Time time)
brokerId
- the ID of the broker that's going to be addedprogressListener
- the listener to call whenever the broker addition operation's progress changesstateMetricReference
- an atomic reference of the current state name to keep up to datepublic long creationTimeMs()
public long lastUpdateTimeMs()
public void initialize()
BrokerAdditionStateManager
by setting the current state
and notify the listener if it's the initial addition statepublic boolean isInitialized()
public BrokerAdditionStateMachine.BrokerAdditionState currentState()
public int brokerId()
public void registerEvent(BrokerAdditionStateMachine.BrokerAdditionEvent event)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic void registerEvent(BrokerAdditionStateMachine.BrokerAdditionEvent event, Exception e)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic boolean isAtATerminalState()