protected final HistoryTree sht;
private final HT_IO treeIO;
+ /** Indicates if the history tree construction is done */
+ protected boolean isFinishedBuilding = false;
+
/**
* Construtor for new history files. Use this when creating a new history
* from scratch.
public HistoryTreeBackend(File existingStateFile) throws IOException {
sht = new HistoryTree(existingStateFile);
treeIO = sht.getTreeIO();
+ isFinishedBuilding = true;
}
@Override
@Override
public void finishedBuilding(long endTime) {
sht.closeTree(endTime);
+ isFinishedBuilding = true;
}
@Override
treeIO.deleteFile();
}
+ @Override
+ public void dispose() {
+ if (isFinishedBuilding) {
+ treeIO.closeFile();
+ } else {
+ /*
+ * The build is being interrupted, delete the file we partially
+ * built since it won't be complete, so shouldn't be re-used in the
+ * future (.deleteFile() will close the file first)
+ */
+ treeIO.deleteFile();
+ }
+ }
+
@Override
public void doQuery(List<ITmfStateInterval> stateInfo, long t)
throws TimeRangeException {