private static void closeFiles() throws IOException { if (myFlushingFuture != null) { myFlushingFuture.cancel(false); myFlushingFuture = null; } if (myNames != null) { myNames.close(); myNames = null; } if (myAttributes != null) { Disposer.dispose(myAttributes); myAttributes = null; } if (myContents != null) { Disposer.dispose(myContents); myContents = null; } if (myRecords != null) { markClean(); myRecords.close(); myRecords = null; } ourInitialized = false; }
public static boolean isDirty() { return myDirty || myNames.isDirty() || myAttributes.isDirty() || myContents.isDirty() || myRecords.isDirty(); }
private static int getAttributeId(String attId) throws IOException { if (myAttributeIds.containsKey(attId)) { return myAttributeIds.get(attId); } int id = myNames.enumerate(attId); myAttributeIds.put(attId, id); return id; }
public static void force() { try { w.lock(); if (myRecords != null) { markClean(); } if (myNames != null) { myNames.force(); myAttributes.force(); myContents.force(); myRecords.force(); } } finally { w.unlock(); } }
public static void flushSome() { if (!isDirty() || HeavyProcessLatch.INSTANCE.isRunning()) return; try { w.lock(); if (myFlushingFuture == null) { return; // avoid NPE when close has already taken place } myNames.force(); final boolean attribsFlushed = myAttributes.flushSome(); final boolean contentsFlushed = myContents.flushSome(); if (attribsFlushed && contentsFlushed) { markClean(); myRecords.force(); } } finally { w.unlock(); } }