Package org.apache.druid.server.http
Class BaseDynamicConfigSyncer<DynamicConfig>
java.lang.Object
org.apache.druid.server.http.BaseDynamicConfigSyncer<DynamicConfig>
- Type Parameters:
DynamicConfig- the type of dynamic configuration (e.g., CoordinatorDynamicConfig, BrokerDynamicConfig)
- Direct Known Subclasses:
BrokerDynamicConfigSyncer,CoordinatorDynamicConfigSyncer
Base class for syncing dynamic configuration to all brokers.
Subclasses must implement:
-
getCurrentConfig() to provide the latest config
- pushConfigToBroker(BrokerClient, Object) to push config via the appropriate BrokerClient method
- getConfigTypeName() for logging-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseDynamicConfigSyncer(ServiceClientFactory clientFactory, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, DruidNodeDiscoveryProvider druidNodeDiscoveryProvider, ServiceEmitter emitter, ScheduledExecutorService exec) -
Method Summary
Modifier and TypeMethodDescriptionvoidPush the latest dynamic config to all currently known Brokers.protected abstract StringGet the name of this config type for logging (e.g., "coordinator dynamic configuration", "broker dynamic configuration").protected abstract DynamicConfigGet the current configuration to broadcast to brokers.Returns the set of Brokers which have been updated with the latest config.voidSchedules a periodic sync with brokers when the coordinator becomes the leader.voidStops the sync when coordinator stops being the leader.protected abstract booleanpushConfigToBroker(BrokerClient brokerClient, DynamicConfig config) Push the config to a broker using the appropriate BrokerClient method.voidQueues the configuration sync to the brokers without blocking the calling thread.voidstop()
-
Constructor Details
-
BaseDynamicConfigSyncer
protected BaseDynamicConfigSyncer(ServiceClientFactory clientFactory, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, DruidNodeDiscoveryProvider druidNodeDiscoveryProvider, ServiceEmitter emitter, ScheduledExecutorService exec)
-
-
Method Details
-
getCurrentConfig
Get the current configuration to broadcast to brokers. -
pushConfigToBroker
protected abstract boolean pushConfigToBroker(BrokerClient brokerClient, DynamicConfig config) throws Exception Push the config to a broker using the appropriate BrokerClient method.- Returns:
- true if the push was successful
- Throws:
Exception
-
getConfigTypeName
Get the name of this config type for logging (e.g., "coordinator dynamic configuration", "broker dynamic configuration"). -
queueBroadcastConfigToBrokers
public void queueBroadcastConfigToBrokers()Queues the configuration sync to the brokers without blocking the calling thread. -
broadcastConfigToBrokers
public void broadcastConfigToBrokers()Push the latest dynamic config to all currently known Brokers. Also invalidates the set of inSyncBrokers if the config has changed. -
getInSyncBrokers
Returns the set of Brokers which have been updated with the latest config. -
onLeaderStart
public void onLeaderStart()Schedules a periodic sync with brokers when the coordinator becomes the leader. -
onLeaderStop
public void onLeaderStop()Stops the sync when coordinator stops being the leader. -
stop
public void stop()
-