@ThreadSafe public class BrokerRemovalStateTracker extends Object implements BrokerRemovalCallback
initialize()
MUST be called on any state tracker instance before it can be utilized.Constructor and Description |
---|
BrokerRemovalStateTracker(int brokerId,
BalancerOperationProgressListener<BrokerRemovalStateMachine.BrokerRemovalState> progressListener,
BalancerOperationTerminationListener<BrokerRemovalStateMachine.BrokerRemovalState> terminationListener,
AtomicReference<String> stateReference,
org.apache.kafka.common.utils.Time time) |
BrokerRemovalStateTracker(int brokerId,
BrokerRemovalStateMachine.BrokerRemovalState initState,
BalancerOperationProgressListener<BrokerRemovalStateMachine.BrokerRemovalState> progressListener,
BalancerOperationTerminationListener<BrokerRemovalStateMachine.BrokerRemovalState> terminationListener,
AtomicReference<String> stateReference,
org.apache.kafka.common.utils.Time time) |
Modifier and Type | Method and Description |
---|---|
int |
brokerId() |
boolean |
cancel(Exception eventException,
BrokerRemovalCancellationMode cancellationMode)
Cancels the broker removal state tracking by setting a terminal canceled state
|
BrokerRemovalStateMachine.BrokerRemovalState |
currentState() |
void |
initialize()
Initialize the RemovalStateTracker by setting the current state and notifying the listener of the initial state.
|
void |
registerEvent(BrokerRemovalStateMachine.BrokerRemovalEvent pe)
Registers a new #
BalancerOperationEvent as part of the progress changing |
void |
registerEvent(BrokerRemovalStateMachine.BrokerRemovalEvent pe,
Exception eventException)
Registers a new errorful #
BalancerOperationEvent as part of the progress changing |
public BrokerRemovalStateTracker(int brokerId, BalancerOperationProgressListener<BrokerRemovalStateMachine.BrokerRemovalState> progressListener, BalancerOperationTerminationListener<BrokerRemovalStateMachine.BrokerRemovalState> terminationListener, AtomicReference<String> stateReference, org.apache.kafka.common.utils.Time time)
brokerId
- the ID of the broker that's going to be removedprogressListener
- the listener to call whenever the broker removal operation's progress changesstateReference
- an atomic reference of the current state name to keep up to datepublic BrokerRemovalStateTracker(int brokerId, BrokerRemovalStateMachine.BrokerRemovalState initState, BalancerOperationProgressListener<BrokerRemovalStateMachine.BrokerRemovalState> progressListener, BalancerOperationTerminationListener<BrokerRemovalStateMachine.BrokerRemovalState> terminationListener, AtomicReference<String> stateReference, org.apache.kafka.common.utils.Time time)
public void initialize()
public int brokerId()
public BrokerRemovalStateMachine.BrokerRemovalState currentState()
public void registerEvent(BrokerRemovalStateMachine.BrokerRemovalEvent pe)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic void registerEvent(BrokerRemovalStateMachine.BrokerRemovalEvent pe, Exception eventException)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic boolean cancel(Exception eventException, BrokerRemovalCancellationMode cancellationMode)