hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1144097 - in /hadoop/common/trunk/mapreduce: CHANGES.txt src/java/org/apache/hadoop/mapred/Counters.java
Date Fri, 08 Jul 2011 00:01:01 GMT
Author: todd
Date: Fri Jul  8 00:01:00 2011
New Revision: 1144097

URL: http://svn.apache.org/viewvc?rev=1144097&view=rev
Log:
MAPREDUCE-2249. Check the reflexive property of Counters objects when comparing equality.
Contributed by Devaraj K.

Modified:
    hadoop/common/trunk/mapreduce/CHANGES.txt
    hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapred/Counters.java

Modified: hadoop/common/trunk/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/mapreduce/CHANGES.txt?rev=1144097&r1=1144096&r2=1144097&view=diff
==============================================================================
--- hadoop/common/trunk/mapreduce/CHANGES.txt (original)
+++ hadoop/common/trunk/mapreduce/CHANGES.txt Fri Jul  8 00:01:00 2011
@@ -180,6 +180,9 @@ Trunk (unreleased changes)
     HADOOP-7106. Reorganize project SVN layout to "unsplit" the projects.
     (todd, nigel)
 
+    MAPREDUCE-2249. Check the reflexive property of Counters objects when
+    comparing equality. (Devaraj K via todd)
+
   OPTIMIZATIONS
 
     MAPREDUCE-2026. Make JobTracker.getJobCounters() and

Modified: hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapred/Counters.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapred/Counters.java?rev=1144097&r1=1144096&r2=1144097&view=diff
==============================================================================
--- hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapred/Counters.java (original)
+++ hadoop/common/trunk/mapreduce/src/java/org/apache/hadoop/mapred/Counters.java Fri Jul
 8 00:01:00 2011
@@ -271,10 +271,16 @@ public class Counters implements Writabl
      * Checks for (content) equality of Groups
      */
     @Override
-    public synchronized boolean equals(Object obj) {
+    public boolean equals(Object obj) {
+      if (this == obj) {
+        return true;
+      }
+      if (obj == null || obj.getClass() != getClass()) {
+        return false;
+      }
       boolean isEqual = false;
-      if (obj != null && obj instanceof Group) {
-        Group g = (Group) obj;
+      Group g = (Group) obj;
+      synchronized (this) {
         if (size() == g.size()) {
           isEqual = true;
           for (Map.Entry<String, Counter> entry : subcounters.entrySet()) {
@@ -769,10 +775,16 @@ public class Counters implements Writabl
   }
 
   @Override
-  public synchronized boolean equals(Object obj) {
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null || obj.getClass() != getClass()) {
+      return false;
+    }
     boolean isEqual = false;
-    if (obj != null && obj instanceof Counters) {
-      Counters other = (Counters) obj;
+    Counters other = (Counters) obj;
+    synchronized (this) {
       if (size() == other.size()) {
         isEqual = true;
         for (Map.Entry<String, Group> entry : this.counters.entrySet()) {



Mime
View raw message