@ThreadSafe public class BrokerRemovalStateTracker extends java.lang.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,
java.util.concurrent.atomic.AtomicReference<java.lang.String> stateReference) |
BrokerRemovalStateTracker(int brokerId,
BrokerRemovalStateMachine.BrokerRemovalState initState,
BalancerOperationProgressListener<BrokerRemovalStateMachine.BrokerRemovalState> progressListener,
BalancerOperationTerminationListener<BrokerRemovalStateMachine.BrokerRemovalState> terminationListener,
java.util.concurrent.atomic.AtomicReference<java.lang.String> stateReference) |
Modifier and Type | Method and Description |
---|---|
int |
brokerId() |
boolean |
cancel(java.lang.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,
java.lang.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, java.util.concurrent.atomic.AtomicReference<java.lang.String> stateReference)
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, java.util.concurrent.atomic.AtomicReference<java.lang.String> stateReference)
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, java.lang.Exception eventException)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic boolean cancel(java.lang.Exception eventException, BrokerRemovalCancellationMode cancellationMode)