Revert "HBASE-19379 TestEndToEndSplitTransaction fails with NPE"

This reverts commit f3614f20c0.
This commit is contained in:
Andrew Purtell 2017-11-29 19:06:29 -08:00
parent f3614f20c0
commit 0b704d4815
1 changed files with 18 additions and 55 deletions

View File

@ -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) {
if (o == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(o instanceof HRegionLocation)) {
return false;
}
HRegionLocation other = (HRegionLocation) obj;
if (regionInfo == null) {
if (other.regionInfo != null) {
return false;
}
} else if (!regionInfo.equals(other.regionInfo)) {
return false;
}
if (seqNum != other.seqNum) {
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());
}
}