@ThreadSafe public class BalancerStatusTracker extends Object implements BalancerStatusCallback
initialize()
MUST be called on the state tracker instance
before it can be utilized.Constructor and Description |
---|
BalancerStatusTracker(int brokerId,
AtomicReference<String> stateMetricReference,
org.apache.kafka.common.utils.Time time) |
Modifier and Type | Method and Description |
---|---|
int |
brokerId() |
BalancerStatusStateMachine.BalancerState |
currentState() |
Optional<Exception> |
exception() |
void |
initialize()
Initialize the #
BalancerStatusTracker by setting the current state and notify the
listener if it's the initial balancer state. |
boolean |
isDisabled() |
boolean |
isInitialized() |
void |
registerEnabledEventIfDisabled()
If balancer was disabled and we are enabling it again, move the
state machine to STARTING state by sending BALANCER_ENABLED event.
|
void |
registerEvent(BalancerStatusStateMachine.BalancerEvent event)
Registers a new #
BalancerOperationEvent as part of the progress changing |
void |
registerEvent(BalancerStatusStateMachine.BalancerEvent event,
Exception e)
Registers a new errorful #
BalancerOperationEvent as part of the progress changing |
public BalancerStatusTracker(int brokerId, AtomicReference<String> stateMetricReference, org.apache.kafka.common.utils.Time time)
public void initialize()
BalancerStatusTracker
by setting the current state and notify the
listener if it's the initial balancer state.public boolean isInitialized()
public boolean isDisabled()
public BalancerStatusStateMachine.BalancerState currentState()
currentState
in interface BalancerOperationCallback<BalancerStatusStateMachine.BalancerState,BalancerStatusStateMachine.BalancerEvent>
public int brokerId()
public void registerEvent(BalancerStatusStateMachine.BalancerEvent event)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingregisterEvent
in interface BalancerOperationCallback<BalancerStatusStateMachine.BalancerState,BalancerStatusStateMachine.BalancerEvent>
public void registerEnabledEventIfDisabled()
public void registerEvent(BalancerStatusStateMachine.BalancerEvent event, Exception e)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingregisterEvent
in interface BalancerOperationCallback<BalancerStatusStateMachine.BalancerState,BalancerStatusStateMachine.BalancerEvent>