public class BrokerShutdownManager extends Object
Constructor and Description |
---|
BrokerShutdownManager(SbkAdminUtils adminUtils,
KafkaCruiseControlConfig config,
BlockingSendClient.Builder blockingSendClientBuilder,
org.apache.kafka.common.utils.Time time) |
Modifier and Type | Method and Description |
---|---|
Map<Integer,Boolean> |
maybeShutdownBrokers(Map<Integer,Optional<Long>> brokersToShutdownAndEpochs)
Ensures that the given brokers are shut down by initiating shutdown via an #
InitiateShutdownRequest
and awaiting their shutdown. |
void |
unregisterBrokers(Set<Integer> brokerIdsToUnregister)
Unregister successfully shutdown brokers #
brokerIdsToUnregister . |
public BrokerShutdownManager(SbkAdminUtils adminUtils, KafkaCruiseControlConfig config, BlockingSendClient.Builder blockingSendClientBuilder, org.apache.kafka.common.utils.Time time)
public Map<Integer,Boolean> maybeShutdownBrokers(Map<Integer,Optional<Long>> brokersToShutdownAndEpochs) throws Exception
InitiateShutdownRequest
and awaiting their shutdown.
This method is blocking for a long time. Approximately a couple of
request timeouts (request.timeout.ms
) and broker.removal.shutdown.timeout.ms
.
Note that this method is not atomic. It is possible that a subset of brokers get shut down while another subset fail shutting down.InitiateShutdownRequest
.
if false, the broker was already shut down and no request was sent.org.apache.kafka.common.errors.TimeoutException
- - if shutdown requests were initiated but at least one broker did not shutdown within the timeoutorg.apache.kafka.common.errors.ApiException
- - if any shutdown request was not successfulException
- - if any broker shutdown failed for any other reasonpublic void unregisterBrokers(Set<Integer> brokerIdsToUnregister) throws Exception
brokerIdsToUnregister
.ExecutionException
- - if any unexpected exception happens while unregistering brokersException