[NO ISSUE] Cleanup for commit b67505d
Change-Id: I370bc289de4a281136e43a3985eb8fae367a6bc6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2034
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
index a58b0b1..b4b846d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
@@ -19,6 +19,8 @@
package org.apache.hyracks.storage.am.lsm.common.impls;
+import java.util.logging.Logger;
+
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.io.IODeviceHandle;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
@@ -26,6 +28,9 @@
import org.apache.hyracks.util.trace.Tracer;
class TracedIOOperation implements ILSMIOOperation {
+
+ static final Logger LOGGER = Logger.getLogger(TracedIOOperation.class.getName());
+
protected final ILSMIOOperation ioOp;
private final LSMIOOpertionType ioOpType;
private final Tracer tracer;
@@ -81,16 +86,26 @@
protected ComparableTracedIOOperation(ILSMIOOperation ioOp, Tracer trace) {
super(ioOp, trace);
- System.err.println("COMPARE ComparableTracedIOOperation");
}
- public int compareTo(ILSMIOOperation other) {
- System.err.println("COMPARE compareTo " + other.getClass().getSimpleName());
- if (other instanceof ComparableTracedIOOperation) {
- other = ((ComparableTracedIOOperation) other).getIoOp();
- return ((Comparable) this.ioOp).compareTo(other);
- }
- throw new IllegalArgumentException("Comparing ioOps of type " + this.ioOp.getClass().getSimpleName() + " and "
- + other.getClass().getSimpleName());
+ @Override
+ public int hashCode() {
+ return this.ioOp.hashCode();
}
-}
\ No newline at end of file
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof ILSMIOOperation && compareTo((ILSMIOOperation) other) == 0;
+ }
+
+ @Override
+ public int compareTo(ILSMIOOperation other) {
+ final ILSMIOOperation myIoOp = this.ioOp;
+ if (myIoOp instanceof Comparable && other instanceof ComparableTracedIOOperation) {
+ return ((Comparable) myIoOp).compareTo(((ComparableTracedIOOperation) other).getIoOp());
+ }
+ LOGGER.warning("Comparing ioOps of type " + myIoOp.getClass().getSimpleName() + " and "
+ + other.getClass().getSimpleName() + " in " + getClass().getSimpleName());
+ return Integer.signum(hashCode() - other.hashCode());
+ }
+}