Swap the order of monitor registration with the TCP channel.
Monitor should be registered before the channel is opened because
channel can start recieving data as soon as it is opened. So not
having a monitor when the channel is opened is disastrous.
diff --git a/hyracks/hyracks-client/src/main/java/edu/uci/ics/hyracks/client/dataset/HyracksDatasetReader.java b/hyracks/hyracks-client/src/main/java/edu/uci/ics/hyracks/client/dataset/HyracksDatasetReader.java
index 03432a8..51e4950 100644
--- a/hyracks/hyracks-client/src/main/java/edu/uci/ics/hyracks/client/dataset/HyracksDatasetReader.java
+++ b/hyracks/hyracks-client/src/main/java/edu/uci/ics/hyracks/client/dataset/HyracksDatasetReader.java
@@ -104,8 +104,8 @@
getSocketAddress(knownRecords[lastReadPartition]), jobId, resultSetId, lastReadPartition,
NUM_READ_BUFFERS);
lastMonitor = getMonitor(lastReadPartition);
- resultChannel.open(datasetClientCtx);
resultChannel.registerMonitor(lastMonitor);
+ resultChannel.open(datasetClientCtx);
} catch (Exception e) {
throw new HyracksDataException(e);
}
@@ -142,8 +142,8 @@
getSocketAddress(knownRecords[lastReadPartition]), jobId, resultSetId,
lastReadPartition, NUM_READ_BUFFERS);
lastMonitor = getMonitor(lastReadPartition);
- resultChannel.open(datasetClientCtx);
resultChannel.registerMonitor(lastMonitor);
+ resultChannel.open(datasetClientCtx);
} catch (Exception e) {
throw new HyracksDataException(e);
}