Source:
protected void handleEvent(ClusterEvent event) { NotificationContext changeContext = event.getAttribute(AttributeName.changeContext.name()); HelixConstants.ChangeType changeType = event.getAttribute(AttributeName.CHANGE_TYPE.name()); if (changeContext == null || changeContext.getType() != NotificationContext.Type.CALLBACK || changeContext.getType() == NotificationContext.Type.PERIODIC_REFRESH) { _dataCache.requireFullRefresh(); } else { _dataCache.notifyDataChange(changeType, changeContext.getPathChanged()); } if (changeContext.getType() == NotificationContext.Type.FINALIZE) { reset(); } else { HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); if (manager == null) { logger.error(String.format("HelixManager is null for router update event: %s", event)); throw new HelixException("HelixManager is null for router update event."); } if (!manager.isConnected()) { logger.error( String.format("HelixManager is not connected for router update event: %s", event)); throw new HelixException("HelixManager is not connected for router update event."); } long startTime = System.currentTimeMillis(); _dataCache.refresh(manager.getHelixDataAccessor()); switch (_sourceDataType) { case EXTERNALVIEW: refresh(_dataCache.getExternalViews().values(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); break; case TARGETEXTERNALVIEW: refresh(_dataCache.getTargetExternalViews().values(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); break; case CURRENTSTATES: refresh(_dataCache.getCurrentStatesMap(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); recordPropagationLatency(System.currentTimeMillis(), _dataCache.getCurrentStateSnapshot()); break; default: logger.warn("Unsupported source data type: {}, stop refreshing the routing table!", _sourceDataType); } _monitor.increaseDataRefreshCounters(startTime); } }

Target:
protected void handleEvent(ClusterEvent event) { NotificationContext changeContext = event.getAttribute(AttributeName.changeContext.name()); HelixConstants.ChangeType changeType = changeContext.getChangeType(); _dataCache.setClusterEventId(event.getEventId()); if (changeContext == null || changeContext.getType() != NotificationContext.Type.CALLBACK) { _dataCache.requireFullRefresh(); } else { _dataCache.notifyDataChange(changeType, changeContext.getPathChanged()); } if (changeContext.getType() == NotificationContext.Type.FINALIZE) { reset(); } else { HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); if (manager == null) { logger.error(String.format("HelixManager is null for router update event: %s", event)); throw new HelixException("HelixManager is null for router update event."); } if (!manager.isConnected()) { logger.error( String.format("HelixManager is not connected for router update event: %s", event)); throw new HelixException("HelixManager is not connected for router update event."); } long startTime = System.currentTimeMillis(); _dataCache.refresh(manager.getHelixDataAccessor()); switch (_sourceDataType) { case EXTERNALVIEW: refresh(_dataCache.getExternalViews().values(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); break; case TARGETEXTERNALVIEW: refresh(_dataCache.getTargetExternalViews().values(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); break; case CURRENTSTATES: refresh(_dataCache.getCurrentStatesMap(), _dataCache.getInstanceConfigMap().values(), _dataCache.getLiveInstances().values()); recordPropagationLatency(System.currentTimeMillis(), _dataCache.getCurrentStateSnapshot()); break; default: logger.warn("Unsupported source data type: {}, stop refreshing the routing table!", _sourceDataType); } _monitor.increaseDataRefreshCounters(startTime); } }