jiajunwang commented on a change in pull request #1154:
URL: https://github.com/apache/helix/pull/1154#discussion_r494575642
##########
File path:
helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
##########
@@ -403,16 +407,35 @@ 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
Review comment:
nit, will "doTriggerCallback" easier to read from the users' perspective?
##########
File path:
helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
##########
@@ -403,16 +407,35 @@ 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());
+ logger.info(
+ "Attach RoutingTableProviderChangeListener {}. The doInit value of
this listener is {}",
Review comment:
nit, we can split "The doInit value of this listener is {}" part. And
move it into the "if" code block below. Might be cleaner.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]