zhangmeng916 commented on a change in pull request #1154:
URL: https://github.com/apache/helix/pull/1154#discussion_r456610082
##########
File path:
helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
##########
@@ -413,6 +413,31 @@ public void addRoutingTableChangeListener(
_routingTableChangeListenerMap.put(routingTableChangeListener, new
ListenerContext(context));
logger.info("Attach RoutingTableProviderChangeListener {}",
routingTableChangeListener.getClass().getName());
+ if (_sourceDataTypeMap.isEmpty()) {
+
routingTableChangeListener.onRoutingTableChange(getRoutingTableSnapshot(),
context);
+ } else {
+ for (PropertyType propertyType : _sourceDataTypeMap.keySet()) {
Review comment:
I see your point, so right now although the routing table provider only
initialized with certain source data types, users will still get callback on
all snapshot change, and they need to filter based on the type to see whether
the change is they want. But I think this change is beyond the scope of this
PR. It's always a problem after we have multiple types, all the Zookeeper
change will trigger callback, if we want to change, we will need to distinguish
between different listeners, and the change also needs to be made in
`notifyRoutingTableChange` when we receive a change.
For this PR only, we do trigger callback based on types, and user won't get
unused callback for those types they don't care. For more general type support
for callback, we'll need more changes. Thoughts?
----------------------------------------------------------------
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]