Package org.apache.druid.discovery
Class BaseNodeRoleWatcher
java.lang.Object
org.apache.druid.discovery.BaseNodeRoleWatcher
Common code used by various implementations of DruidNodeDiscovery.
User code is supposed to arrange for following methods to be called,
childAdded(DiscoveryDruidNode)
childRemoved(DiscoveryDruidNode)
cacheInitialized()
resetNodes(Map)
Then registerListener(DruidNodeDiscovery.Listener) and getAllNodes() can be delegated to the
implementation here.-
Constructor Summary
ConstructorsConstructorDescriptionBaseNodeRoleWatcher(ScheduledExecutorService listenerExecutor, NodeRole nodeRole) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidchildAdded(DiscoveryDruidNode druidNode) voidchildRemoved(DiscoveryDruidNode druidNode) voidchildRemoved(DiscoveryDruidNode druidNode, boolean skipIfUnknown) Remove a node from the discovery cache.static BaseNodeRoleWatchercreate(ScheduledExecutorService listenerExecutor, NodeRole nodeRole) voidregisterListener(DruidNodeDiscovery.Listener listener) voidresetNodes(Map<String, DiscoveryDruidNode> fullNodes)
-
Constructor Details
-
BaseNodeRoleWatcher
-
-
Method Details
-
create
public static BaseNodeRoleWatcher create(ScheduledExecutorService listenerExecutor, NodeRole nodeRole) -
getAllNodes
-
registerListener
-
childAdded
-
childRemoved
-
childRemoved
Remove a node from the discovery cache.If
skipIfUnknownis true, the removal is skipped if the node is not already present in the cache. If false, the removal is attempted unconditionally. -
cacheInitialized
public void cacheInitialized() -
resetNodes
-