HDFS-3293. Add toString(), equals(..) and hashCode() to JournalInfo. Contributed by Hari Mankude
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1332458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1e88c1f088
commit
2af70cb517
@ -74,6 +74,9 @@ Trunk (unreleased changes)
|
||||
HDFS-2743. Streamline usage of bookkeeper journal manager.
|
||||
(Ivan Kelly via umamahesh)
|
||||
|
||||
HDFS-3293. Add toString(), equals(..) and hashCode() to JournalInfo.
|
||||
(Hari Mankude via szetszwo)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HDFS-2834. Add a ByteBuffer-based read API to DFSInputStream.
|
||||
|
@ -45,4 +45,29 @@ public String getClusterId() {
|
||||
public int getNamespaceId() {
|
||||
return namespaceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("lv=").append(layoutVersion).append(";cid=").append(clusterId)
|
||||
.append(";nsid=").append(namespaceId);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
JournalInfo jInfo;
|
||||
if (!(o instanceof JournalInfo)) {
|
||||
return false;
|
||||
}
|
||||
jInfo = (JournalInfo) o;
|
||||
return ((jInfo.clusterId.equals(this.clusterId))
|
||||
&& (jInfo.namespaceId == this.namespaceId)
|
||||
&& (jInfo.layoutVersion == this.layoutVersion));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (namespaceId ^ layoutVersion ^ clusterId.hashCode());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user