@Override public void close() { if (nodeIndex != null) nodeIndex.close(); nodeIndex = null; // Closing the journal flushes it; i.e. disk IO. if (journalObjFile != null) journalObjFile.close(); journalObjFile = null; }
private void writeNodeJournal() { long expected = base.allocOffset().getId(); long len = journalObjFile.length(); if (expected != allocOffset) warn(log, "Inconsistency: base.allocOffset() = %d : allocOffset = %d", expected, allocOffset); long newbase = -1; append(); // Calls all() which does a buffer flish. // Reset (in case we use this again) nodeIndex.clear(); journalObjFile.truncate(journalObjFileStartOffset); // Side effect is a buffer flush. // journalObjFile.sync() ; journalObjFile.close(); // Side effect is a buffer flush. journalObjFile = null; base.sync(); allocOffset = -99; // base.allocOffset().getId() ; // Will be invalid as we may write through to the base // table later. passthrough = true; }