abhishekagarwal87 commented on code in PR #15726:
URL: https://github.com/apache/druid/pull/15726#discussion_r1477744965


##########
server/src/main/java/org/apache/druid/curator/discovery/CuratorDruidNodeDiscoveryProvider.java:
##########
@@ -184,12 +187,19 @@ private static class NodeRoleWatcher implements 
DruidNodeDiscovery, Closeable
       this.curatorFramework = curatorFramework;
       this.nodeRole = nodeRole;
       this.jsonMapper = jsonMapper;
-      this.baseNodeRoleWatcher = new BaseNodeRoleWatcher(listenerExecutor, 
nodeRole);
+      this.listenerExecutor = listenerExecutor;
+      this.basePath = basePath;
 
       // This is required to be single threaded from docs in PathChildrenCache.
       this.cacheExecutor = Execs.singleThreaded(
           StringUtils.format("NodeRoleWatcher[%s]", 
StringUtils.encodeForFormat(nodeRole.toString()))
       );
+      refreshCache();
+    }
+
+    public void refreshCache()
+    {
+      baseNodeRoleWatcher = new BaseNodeRoleWatcher(listenerExecutor, 
nodeRole);

Review Comment:
   We should reuse this since a listener might have already been registered. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to