@ThreadSafe public class BrokerAdditionV2StateManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BrokerAdditionV2StateManager.PendingAddition
A pending broker addition containing the broker ID of the broker being added
and the unix timestamp, in milliseconds, of when the addition was created.
|
Constructor and Description |
---|
BrokerAdditionV2StateManager(ApiStatePersistenceStore persistenceStore) |
Modifier and Type | Method and Description |
---|---|
List<kafka.common.BrokerAdditionDescriptionInternal> |
brokerAdditionDescriptions() |
void |
completeAddition(int brokerId)
Successfully completes the ongoing broker addition operation for the given broker id by persisting it to the state topic.
|
void |
initializeAddition(int brokerId)
Initializes a new v2 broker addition operation for the given broker
brokerId
by persisting a new record in the api state topic. |
boolean |
maybeCancelAddition(int brokerId,
String cause) |
List<BrokerAdditionV2StateManager.PendingAddition> |
pendingBrokerAdditions()
Returns a list of broker ids that are in progress of being added.
|
public BrokerAdditionV2StateManager(ApiStatePersistenceStore persistenceStore)
public boolean maybeCancelAddition(int brokerId, String cause) throws InterruptedException
InterruptedException
public List<kafka.common.BrokerAdditionDescriptionInternal> brokerAdditionDescriptions()
public List<BrokerAdditionV2StateManager.PendingAddition> pendingBrokerAdditions()
public void initializeAddition(int brokerId) throws InterruptedException
brokerId
by persisting a new record in the api state topic.brokerId
- the id of the broker to addIllegalStateException
- if there is already an in-progress addition operation ongoing for the given brokerInterruptedException
public void completeAddition(int brokerId) throws InterruptedException
brokerId
- The broker ID for which the addition operation should be completed.Exception
- in case the state transition is not valid or there is no present addition operation for the given broker.InterruptedException