Repository: hbase Updated Branches: refs/heads/branch-1 f3614f20c -> 0b704d481
Revert "HBASE-19379 TestEndToEndSplitTransaction fails with NPE" This reverts commit f3614f20c00a455dd59d6ca46abaa00123b946f9. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0b704d48 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0b704d48 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0b704d48 Branch: refs/heads/branch-1 Commit: 0b704d4815892963e7355aa7a587825943b107a0 Parents: f3614f2 Author: Andrew Purtell <[email protected]> Authored: Wed Nov 29 19:06:29 2017 -0800 Committer: Andrew Purtell <[email protected]> Committed: Wed Nov 29 19:06:29 2017 -0800 ---------------------------------------------------------------------- .../apache/hadoop/hbase/HRegionLocation.java | 73 +++++--------------- 1 file changed, 18 insertions(+), 55 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/0b704d48/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java index ff78ddc..373e76b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java @@ -61,71 +61,29 @@ public class HRegionLocation implements Comparable<HRegionLocation> { + ", hostname=" + this.serverName + ", seqNum=" + seqNum; } + /** + * @see java.lang.Object#equals(java.lang.Object) + */ @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((regionInfo == null) ? 0 : regionInfo.hashCode()); - result = prime * result + (int) (seqNum ^ (seqNum >>> 32)); - result = prime * result + ((serverName == null) ? 0 : serverName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { + public boolean equals(Object o) { + if (this == o) { return true; } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - HRegionLocation other = (HRegionLocation) obj; - if (regionInfo == null) { - if (other.regionInfo != null) { - return false; - } - } else if (!regionInfo.equals(other.regionInfo)) { + if (o == null) { return false; } - if (seqNum != other.seqNum) { + if (!(o instanceof HRegionLocation)) { return false; } - if (serverName == null) { - if (other.serverName != null) { - return false; - } - } else if (!serverName.equals(other.serverName)) { - return false; - } - return true; + return this.compareTo((HRegionLocation)o) == 0; } + /** + * @see java.lang.Object#hashCode() + */ @Override - public int compareTo(HRegionLocation other) { - if (regionInfo == null) { - if (other.regionInfo != null) { - return 1; - } - } else { - int compare = regionInfo.compareTo(other.regionInfo); - if (compare != 0) { - return compare; - } - } - if (serverName == null) { - if (other.serverName != null) { - return 1; - } - } else { - int compare = serverName.compareTo(other.serverName); - if (compare != 0) { - return compare; - } - } - return Long.compare(seqNum, other.seqNum); + public int hashCode() { + return this.serverName.hashCode(); } /** @return HRegionInfo */ @@ -155,4 +113,9 @@ public class HRegionLocation implements Comparable<HRegionLocation> { public ServerName getServerName() { return serverName; } + + @Override + public int compareTo(HRegionLocation o) { + return serverName.compareTo(o.getServerName()); + } }
