From 3757e731e674934543dd29d82e9826f4c936ac1e Mon Sep 17 00:00:00 2001 From: Gera Shegalov Date: Fri, 3 Apr 2015 10:24:02 -0700 Subject: [PATCH] MAPREDUCE-4844. Counters / AbstractCounters have constant references not declared final. (Brahma Reddy Battula via gera) (cherry picked from commit a0795c1e81685b812288cf2f4df6f8d23da30ab8) --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/mapred/Counters.java | 6 +++--- .../apache/hadoop/mapreduce/counters/AbstractCounters.java | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index ad75410cdeb..d75fda20420 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -76,6 +76,9 @@ Release 2.8.0 - UNRELEASED causes counter limits are not reset correctly. (Zhihai Xu via harsh) + MAPREDUCE-4844. Counters / AbstractCounters have constant references not + declared final. (Brahma Reddy Battula via gera) + Release 2.7.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Counters.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Counters.java index b9cb210325f..c9e0b9fc7ca 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Counters.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Counters.java @@ -62,9 +62,9 @@ import com.google.common.collect.Iterators; public class Counters extends AbstractCounters { - public static int MAX_COUNTER_LIMIT = Limits.getCountersMax(); - public static int MAX_GROUP_LIMIT = Limits.getGroupsMax(); - private static HashMap depricatedCounterMap = + public static final int MAX_COUNTER_LIMIT = Limits.getCountersMax(); + public static final int MAX_GROUP_LIMIT = Limits.getGroupsMax(); + private static final HashMap depricatedCounterMap = new HashMap(); static { diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java index dd81ebb55f9..e6e74da1190 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java @@ -64,11 +64,11 @@ public abstract class AbstractCounters, C> cache = Maps.newIdentityHashMap(); + private final Map, C> cache = Maps.newIdentityHashMap(); //framework & fs groups - private Map fgroups = new ConcurrentSkipListMap(); + private final Map fgroups = new ConcurrentSkipListMap(); // other groups - private Map groups = new ConcurrentSkipListMap(); + private final Map groups = new ConcurrentSkipListMap(); private final CounterGroupFactory groupFactory; // For framework counter serialization without strings