HDFS-5266. ElasticByteBufferPool#Key does not implement equals. Contributed by Chris Nauroth.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-4949@1526671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9a361c5821
commit
8f17d64527
@ -31,7 +31,7 @@ public interface ByteBufferPool {
|
|||||||
* new buffer.
|
* new buffer.
|
||||||
*
|
*
|
||||||
* @param direct Whether the buffer should be direct.
|
* @param direct Whether the buffer should be direct.
|
||||||
* @param minLength The minimum length the buffer will have.
|
* @param length The minimum length the buffer will have.
|
||||||
* @return A new ByteBuffer. This ByteBuffer must be direct.
|
* @return A new ByteBuffer. This ByteBuffer must be direct.
|
||||||
* Its capacity can be less than what was requested, but
|
* Its capacity can be less than what was requested, but
|
||||||
* must be at least 1 byte.
|
* must be at least 1 byte.
|
||||||
|
@ -52,6 +52,16 @@ public int compareTo(Key other) {
|
|||||||
compare(insertionTime, other.insertionTime).
|
compare(insertionTime, other.insertionTime).
|
||||||
result();
|
result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object rhs) {
|
||||||
|
try {
|
||||||
|
Key o = (Key)rhs;
|
||||||
|
return (compareTo(o) == 0);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final TreeMap<Key, ByteBuffer> buffers =
|
private final TreeMap<Key, ByteBuffer> buffers =
|
||||||
|
@ -64,3 +64,5 @@ HDFS-4949 (Unreleased)
|
|||||||
|
|
||||||
HDFS-5210. Fix some failing unit tests on HDFS-4949 branch.
|
HDFS-5210. Fix some failing unit tests on HDFS-4949 branch.
|
||||||
(Contributed by Andrew Wang)
|
(Contributed by Andrew Wang)
|
||||||
|
|
||||||
|
HDFS-5266. ElasticByteBufferPool#Key does not implement equals. (cnauroth)
|
||||||
|
Loading…
Reference in New Issue
Block a user