Source:
private void refreshContexts(HelixDataAccessor accessor) { long start = System.currentTimeMillis(); _contextMap.clear(); _initialContextMapHashcode.clear(); if (_controlContextProvider.getClusterName() == null || _controlContextProvider.getClusterName() .equalsIgnoreCase(UNKNOWN_CLUSTER)) { return; } String path = String.format("/%s/%s%s", _controlContextProvider.getClusterName(), PropertyType.PROPERTYSTORE.name(), TaskConstants.REBALANCER_CONTEXT_ROOT); List<String> contextPaths = new ArrayList<>(); List<String> childNames = accessor.getBaseDataAccessor().getChildNames(path, 0); if (childNames == null) { return; } for (String resourceName : childNames) { contextPaths.add(getTaskDataPath(resourceName, TaskDataType.CONTEXT)); } List<ZNRecord> contexts = accessor.getBaseDataAccessor().get(contextPaths, null, 0, true); for (int i = 0; i < contexts.size(); i++) { ZNRecord context = contexts.get(i); if (context != null && context.getSimpleField(NAME) != null) { _contextMap.put(context.getSimpleField(NAME), context); } else { _contextMap.put(childNames.get(i), context); LogUtil.logDebug(LOG, genEventInfo(), String.format("Context for %s is null or miss the context NAME!", childNames.get((i)))); } } for (Map.Entry<String, ZNRecord> entry : _contextMap.entrySet()) { if (entry.getValue() != null) { _initialContextMapHashcode.put(entry.getKey(), Objects.hashCode(entry.getValue().toString())); } } if (LOG.isDebugEnabled()) { LogUtil.logDebug(LOG, genEventInfo(), "# of workflow/job context read from zk: " + _contextMap.size() + ". Take " + ( System.currentTimeMillis() - start) + " ms"); } }

Target:
private void refreshContexts(HelixDataAccessor accessor) { long start = System.currentTimeMillis(); _contextMap.clear(); _initialContextMapHashcode.clear(); if (_controlContextProvider.getClusterName() == null || _controlContextProvider.getClusterName() .equalsIgnoreCase(UNKNOWN_CLUSTER)) { return; } String path = String.format("/%s/%s%s", _controlContextProvider.getClusterName(), PropertyType.PROPERTYSTORE.name(), TaskConstants.REBALANCER_CONTEXT_ROOT); List<String> contextPaths = new ArrayList<>(); List<String> childNames = accessor.getBaseDataAccessor().getChildNames(path, 0); if (childNames == null) { return; } for (String resourceName : childNames) { contextPaths.add(getTaskDataPath(resourceName, TaskDataType.CONTEXT)); } List<ZNRecord> contexts = accessor.getBaseDataAccessor().get(contextPaths, null, 0, true); for (int i = 0; i < contexts.size(); i++) { ZNRecord context = contexts.get(i); if (context != null && context.getSimpleField(NAME) != null) { _contextMap.put(context.getSimpleField(NAME), context); } else { _contextMap.put(childNames.get(i), context); LogUtil.logDebug(LOG, genEventInfo(), String.format("Context for %s is null or miss the context NAME!", childNames.get((i)))); } } for (Map.Entry<String, ZNRecord> entry : _contextMap.entrySet()) { if (entry.getValue() != null) { _initialContextMapHashcode.put(entry.getKey(), DigestUtils.md5Hex(entry.getValue().toString())); } } if (LOG.isDebugEnabled()) { LogUtil.logDebug(LOG, genEventInfo(), "# of workflow/job context read from zk: " + _contextMap.size() + ". Take " + ( System.currentTimeMillis() - start) + " ms"); } }