|
@@ -18,6 +18,7 @@
|
|
|
package org.apache.hadoop.io;
|
|
|
|
|
|
import com.google.common.collect.ComparisonChain;
|
|
|
+import org.apache.commons.lang.builder.HashCodeBuilder;
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
import java.util.Map;
|
|
@@ -55,6 +56,9 @@ public final class ElasticByteBufferPool implements ByteBufferPool {
|
|
|
|
|
|
@Override
|
|
|
public boolean equals(Object rhs) {
|
|
|
+ if (rhs == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
try {
|
|
|
Key o = (Key)rhs;
|
|
|
return (compareTo(o) == 0);
|
|
@@ -62,6 +66,14 @@ public final class ElasticByteBufferPool implements ByteBufferPool {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int hashCode() {
|
|
|
+ return new HashCodeBuilder().
|
|
|
+ append(capacity).
|
|
|
+ append(insertionTime).
|
|
|
+ toHashCode();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private final TreeMap<Key, ByteBuffer> buffers =
|