You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/08/03 06:29:40 UTC

[GitHub] [helix] narendly commented on a change in pull request #1154: Add initial callback when adding routing table listener

narendly commented on a change in pull request #1154:
URL: https://github.com/apache/helix/pull/1154#discussion_r464217408



##########
File path: helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
##########
@@ -403,16 +403,55 @@ public RoutingTableSnapshot getRoutingTableSnapshot(PropertyType propertyType, S
     return snapshots;
   }
 
+
   /**
    * Add RoutingTableChangeListener with user defined context
    * @param routingTableChangeListener
    * @param context user defined context
    */
   public void addRoutingTableChangeListener(
       final RoutingTableChangeListener routingTableChangeListener, Object context) {
+    addRoutingTableChangeListener(routingTableChangeListener, context, false);
+  }
+
+  /**
+   * Add RoutingTableChangeListener with user defined context
+   * @param routingTableChangeListener
+   * @param context user defined context
+   * @param doInit whether to trigger the initial callback during adding listener
+   */
+  public void addRoutingTableChangeListener(
+      final RoutingTableChangeListener routingTableChangeListener, Object context, boolean doInit) {
     _routingTableChangeListenerMap.put(routingTableChangeListener, new ListenerContext(context));
     logger.info("Attach RoutingTableProviderChangeListener {}",
         routingTableChangeListener.getClass().getName());
+    if (doInit) {
+      if (_sourceDataTypeMap.isEmpty()) {

Review comment:
       Sorry if my comment wasn't clear. What I was saying was since `RoutingTableProvider` doesn't give its own reference and doesn't implement `RoutingTableChangeListener`, we probably don't have to worry about this and we shouldn't have to add a null check here. I think it should be okay as is :)




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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org