Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2800#discussion_r210633216
--- Diff: storm-client/src/jvm/org/apache/storm/stats/StatsUtil.java ---
@@ -1565,23 +1565,26 @@ public static ComponentPageInfo aggCompExecsStats(
public static void updateHeartbeatCache(Map<List<Integer>, Map<String,
Object>> cache,
Map<List<Integer>, Map<String,
Object>> executorBeats, Set<List<Integer>> executors,
Integer timeout) {
- //if not executor beats, refresh is-timed-out of the cache which
is done by master
+ assert cache instanceof ConcurrentMap;
+ //Should we enforce update-if-newer policy?
if (executorBeats == null) {
- for (Map.Entry<List<Integer>, Map<String, Object>>
executorbeat : cache.entrySet()) {
- Map<String, Object> beat = executorbeat.getValue();
+ //If not executor beats, refresh is-timed-out of the cache
which is done by master
+ for (Map.Entry<List<Integer>, Map<String, Object>>
executorBeat : cache.entrySet()) {
+ Map<String, Object> beat = executorBeat.getValue();
beat.put("is-timed-out", Time.deltaSecs((Integer)
beat.get("nimbus-time")) >= timeout);
}
- return;
- }
- //else refresh nimbus-time and executor-reported-time by
heartbeats reporting
- for (List<Integer> executor : executors) {
- cache.put(executor, updateExecutorCache(cache.get(executor),
executorBeats.get(executor), timeout));
+ } else {
--- End diff --
Nit: Explicit return can help decrease indentation, I liked it better
before.
---