alirezazamani commented on a change in pull request #834: Complete the Routing 
Table Provider for CustomizedView
URL: https://github.com/apache/helix/pull/834#discussion_r395309597
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
 ##########
 @@ -199,6 +201,98 @@ public void run() {
     }
   }
 
+  /**
+   * A method that adds the ChangeListeners to HelixManager
+   */
+  private void addListeners() {
+    if (_helixManager != null) {
+      for (PropertyType propertyType : _sourceDataTypeMap.keySet()) {
+        switch (propertyType) {
+        case EXTERNALVIEW:
+          try {
+            _helixManager.addExternalViewChangeListener(this);
+          } catch (Exception e) {
+            shutdown();
+            logger.error("Failed to attach ExternalView Listener to 
HelixManager!");
+            throw new HelixException("Failed to attach ExternalView Listener 
to HelixManager!", e);
+          }
+          break;
+        case CUSTOMIZEDVIEW:
+          List<String> customizedStateTypes = 
_sourceDataTypeMap.get(propertyType);
+          for (String customizedStateType : customizedStateTypes) {
+            try {
+              _helixManager.addCustomizedViewChangeListener(this, 
customizedStateType);
+            } catch (Exception e) {
+              shutdown();
+              logger.error("Failed to attach CustomizedView Listener to 
HelixManager for type {}!",
+                  customizedStateType);
+              throw new HelixException(String.format(
+                  "Failed to attach CustomizedView Listener to HelixManager 
for type %s!",
+                  customizedStateType), e);
+            }
+          }
+          break;
+        case TARGETEXTERNALVIEW:
+          // Check whether target external has been enabled or not
+          if 
(!_helixManager.getHelixDataAccessor().getBaseDataAccessor().exists(
+              
_helixManager.getHelixDataAccessor().keyBuilder().targetExternalViews().getPath(),
+              0)) {
+            shutdown();
+            throw new HelixException("Target External View is not enabled!");
+          }
+
+          try {
+            _helixManager.addTargetExternalViewChangeListener(this);
+          } catch (Exception e) {
+            shutdown();
+            logger.error("Failed to attach TargetExternalView Listener to 
HelixManager!");
 
 Review comment:
   I agree. Removed.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to