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/03/24 19:10:55 UTC
[GitHub] [helix] narendly commented on a change in pull request #908: Make
Helix REST realm-aware
narendly commented on a change in pull request #908: Make Helix REST realm-aware
URL: https://github.com/apache/helix/pull/908#discussion_r397397806
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/ServerContext.java
##########
@@ -165,5 +238,93 @@ public void close() {
if (_zkMetadataStoreDirectory != null) {
_zkMetadataStoreDirectory.close();
}
+ if (_zkClientForListener != null) {
+ _zkClientForListener.close();
+ }
+ }
+
+ @Override
+ public void handleChildChange(String parentPath, List<String> currentChilds) {
+ if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
+ return;
+ }
+ // Resubscribe
+ _zkClientForListener.unsubscribeAll();
+ ZkRoutingDataReader.subscribeRoutingDataChanges(_zkClientForListener, this, this);
+ resetZkResources();
+ }
+
+ @Override
+ public void handleDataChange(String dataPath, Object data) {
+ if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
+ return;
+ }
+ resetZkResources();
+ }
+
+ @Override
+ public void handleDataDeleted(String dataPath) {
+ if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
+ return;
+ }
+ // Resubscribe
+ _zkClientForListener.unsubscribeAll();
+ ZkRoutingDataReader.subscribeRoutingDataChanges(_zkClientForListener, this, this);
+ resetZkResources();
Review comment:
Updated. It's hard to reduce duplication further because we need to sneak in unsubscribe/resubscribe for some callback functions.
----------------------------------------------------------------
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: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org