MAPREDUCE-2249. Check the reflexive property of Counters objects when comparing equality. Contributed by Devaraj K.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1144097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
637cdaefc2
commit
86236dd6c4
@ -180,6 +180,9 @@ Trunk (unreleased changes)
|
|||||||
HADOOP-7106. Reorganize project SVN layout to "unsplit" the projects.
|
HADOOP-7106. Reorganize project SVN layout to "unsplit" the projects.
|
||||||
(todd, nigel)
|
(todd, nigel)
|
||||||
|
|
||||||
|
MAPREDUCE-2249. Check the reflexive property of Counters objects when
|
||||||
|
comparing equality. (Devaraj K via todd)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
MAPREDUCE-2026. Make JobTracker.getJobCounters() and
|
MAPREDUCE-2026. Make JobTracker.getJobCounters() and
|
||||||
|
@ -271,10 +271,16 @@ public class Counters implements Writable, Iterable<Counters.Group> {
|
|||||||
* Checks for (content) equality of Groups
|
* Checks for (content) equality of Groups
|
||||||
*/
|
*/
|
||||||
@Override
|
@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;
|
boolean isEqual = false;
|
||||||
if (obj != null && obj instanceof Group) {
|
|
||||||
Group g = (Group) obj;
|
Group g = (Group) obj;
|
||||||
|
synchronized (this) {
|
||||||
if (size() == g.size()) {
|
if (size() == g.size()) {
|
||||||
isEqual = true;
|
isEqual = true;
|
||||||
for (Map.Entry<String, Counter> entry : subcounters.entrySet()) {
|
for (Map.Entry<String, Counter> entry : subcounters.entrySet()) {
|
||||||
@ -769,10 +775,16 @@ public class Counters implements Writable, Iterable<Counters.Group> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
boolean isEqual = false;
|
||||||
if (obj != null && obj instanceof Counters) {
|
|
||||||
Counters other = (Counters) obj;
|
Counters other = (Counters) obj;
|
||||||
|
synchronized (this) {
|
||||||
if (size() == other.size()) {
|
if (size() == other.size()) {
|
||||||
isEqual = true;
|
isEqual = true;
|
||||||
for (Map.Entry<String, Group> entry : this.counters.entrySet()) {
|
for (Map.Entry<String, Group> entry : this.counters.entrySet()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user