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


##########
server/src/main/java/org/apache/druid/curator/discovery/CuratorDruidNodeDiscoveryProvider.java:
##########
@@ -184,12 +186,18 @@ private static class NodeRoleWatcher implements 
DruidNodeDiscovery, Closeable
       this.curatorFramework = curatorFramework;
       this.nodeRole = nodeRole;
       this.jsonMapper = jsonMapper;
-      this.baseNodeRoleWatcher = new BaseNodeRoleWatcher(listenerExecutor, 
nodeRole);
+      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()))
       );
+      baseNodeRoleWatcher = new BaseNodeRoleWatcher(listenerExecutor, 
nodeRole);
+      refreshCache();
+    }
+
+    public synchronized void refreshCache()
+    {
       cache = new PathChildrenCacheFactory.Builder()

Review Comment:
   you need to stop the previous cache as well



-- 
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