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

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/spectator/RoutingDataCache.java
 ##########
 @@ -65,32 +87,55 @@ public synchronized void refresh(HelixDataAccessor 
accessor) {
     long startTime = System.currentTimeMillis();
 
     super.refresh(accessor);
-
-    if (_sourceDataType.equals(PropertyType.TARGETEXTERNALVIEW) && 
_propertyDataChangedMap
-        .get(HelixConstants.ChangeType.TARGET_EXTERNAL_VIEW)) {
-      long start = System.currentTimeMillis();
-      
_propertyDataChangedMap.put(HelixConstants.ChangeType.TARGET_EXTERNAL_VIEW, 
false);
-      _targetExternalViewCache.refresh(accessor);
-      LOG.info("Reload " + 
_targetExternalViewCache.getExternalViewMap().keySet().size()
-          + " TargetExternalViews. Takes " + (System.currentTimeMillis() - 
start) + " ms");
+    for (PropertyType propertyType : _sourceDataTypeMap.keySet()) {
+      switch (propertyType) {
+      case TARGETEXTERNALVIEW:
+        if 
(_propertyDataChangedMap.get(HelixConstants.ChangeType.TARGET_EXTERNAL_VIEW)) {
+          long start = System.currentTimeMillis();
+          
_propertyDataChangedMap.put(HelixConstants.ChangeType.TARGET_EXTERNAL_VIEW, 
false);
+          _targetExternalViewCache.refresh(accessor);
+          LOG.info("Reload " + 
_targetExternalViewCache.getExternalViewMap().keySet().size()
+              + " TargetExternalViews. Takes " + (System.currentTimeMillis() - 
start) + " ms");
+        }
+        break;
+      case CURRENTSTATES:
+        if 
(_propertyDataChangedMap.get(HelixConstants.ChangeType.CURRENT_STATE)) {
+          long start = System.currentTimeMillis();
+          _propertyDataChangedMap.put(HelixConstants.ChangeType.CURRENT_STATE, 
false);
+          Map<String, LiveInstance> liveInstanceMap = getLiveInstances();
+          _currentStateCache.refresh(accessor, liveInstanceMap);
+          LOG.info("Reload CurrentStates. Takes " + 
(System.currentTimeMillis() - start) + " ms");
+        }
+        break;
+      case CUSTOMIZEDVIEW: {
+        for (String customizedStateType : 
_sourceDataTypeMap.get(PropertyType.CUSTOMIZEDVIEW)) {
+          if 
(_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_VIEW)) {
+            long start = System.currentTimeMillis();
+            _customizedViewCaches.get(customizedStateType).refresh(accessor);
+            LOG.info("Reload "
 
 Review comment:
   Also, this log should be able to move out if we add some local vars for the 
log info.

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