Implement a method to return valid file references.
git-svn-id: https://hyracks.googlecode.com/svn/branches/fullstack_hyracks_result_distribution@3077 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/DatasetPartitionReader.java b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/DatasetPartitionReader.java
index 7b2b30a..296c502 100644
--- a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/DatasetPartitionReader.java
+++ b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/DatasetPartitionReader.java
@@ -85,7 +85,7 @@
NetworkOutputChannel channel = (NetworkOutputChannel) writer;
channel.setFrameSize(resultState.getFrameSize());
try {
- fileHandle = resultState.getIOManager().open(resultState.getFileReference(),
+ fileHandle = resultState.getIOManager().open(resultState.getValidFileReference(),
IIOManager.FileReadWriteMode.READ_ONLY, IIOManager.FileSyncMode.METADATA_ASYNC_DATA_ASYNC);
channel.open();
try {
@@ -108,6 +108,8 @@
channel.close();
resultState.getIOManager().close(fileHandle);
}
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
} catch (HyracksDataException e) {
throw new RuntimeException(e);
}
diff --git a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/ResultState.java b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/ResultState.java
index d2e86bc..3db3fd9 100644
--- a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/ResultState.java
+++ b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/dataset/ResultState.java
@@ -56,11 +56,12 @@
localPageList = new ArrayList<Page>();
}
- public void init(FileReference fileRef) {
+ public synchronized void init(FileReference fileRef) {
this.fileRef = fileRef;
size = 0;
persistentSize = 0;
+ notifyAll();
}
public ResultSetPartitionId getResultSetPartitionId() {
@@ -139,7 +140,9 @@
return page;
}
- public FileReference getFileReference() {
+ public synchronized FileReference getValidFileReference() throws InterruptedException {
+ while (fileRef == null)
+ wait();
return fileRef;
}