You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/12/10 00:13:19 UTC

[GitHub] [incubator-druid] clintropolis commented on a change in pull request #9005: Fix broken master

clintropolis commented on a change in pull request #9005: Fix broken master
URL: https://github.com/apache/incubator-druid/pull/9005#discussion_r355756086
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/http/SelfDiscoveryResource.java
 ##########
 @@ -44,58 +47,68 @@
  * DI configuration phase.
  */
 @Singleton
+@Path("/status/selfDiscovered")
 public class SelfDiscoveryResource
 {
-  private BooleanSupplier selfDiscovered;
+  private final List<BooleanSupplier> selfDiscoveredRoles;
 
   @Inject
   public SelfDiscoveryResource(
       @Self DruidNode thisDruidNode,
-      @Self NodeRole thisNodeRole,
+      @Self Set<NodeRole> thisNodeRoles,
       DruidNodeDiscoveryProvider nodeDiscoveryProvider,
       Lifecycle lifecycle
   )
   {
-    Lifecycle.Handler selfDiscoveryListenerRegistrator = new Lifecycle.Handler()
-    {
-      @Override
-      public void start()
-      {
-        selfDiscovered = nodeDiscoveryProvider.getForNode(thisDruidNode, thisNodeRole);
-      }
+    selfDiscoveredRoles = Lists.newArrayListWithExpectedSize(thisNodeRoles.size());
+    thisNodeRoles.forEach(
+        thisNodeRole -> {
+          Lifecycle.Handler selfDiscoveryListenerRegistrator = new Lifecycle.Handler()
+          {
+            @Override
+            public void start()
+            {
+              selfDiscoveredRoles.add(nodeDiscoveryProvider.getForNode(thisDruidNode, thisNodeRole));
+            }
 
-      @Override
-      public void stop()
-      {
-        // do nothing
-      }
-    };
-    // Using Lifecycle.Stage.SERVER because DruidNodeDiscoveryProvider should be already started when
-    // selfDiscoveryListenerRegistrator.start() is called.
-    lifecycle.addHandler(selfDiscoveryListenerRegistrator, Lifecycle.Stage.SERVER);
+            @Override
+            public void stop()
+            {
+              // do nothing
+            }
+          };
+          // Using Lifecycle.Stage.SERVER because DruidNodeDiscoveryProvider should be already started when
+          // selfDiscoveryListenerRegistrator.start() is called.
+          lifecycle.addHandler(selfDiscoveryListenerRegistrator, Lifecycle.Stage.SERVER);
+        }
+    );
   }
 
   /** See the description of this endpoint in api-reference.md. */
   @GET
-  @Path("/status/selfDiscoveredStatus")
+  @Path("/status")
 
 Review comment:
   Since this changes the API path of `/status/selfDiscoveredStatus` to `/status/selfDiscovered/status` the docs in api-reference.md need updated

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org