private static void setCurrentVersion() { myRecords.putInt(HEADER_VERSION_OFFSET, VERSION); myRecords.putLong(HEADER_TIMESTAMP_OFFSET, System.currentTimeMillis()); myAttributes.setVersion(VERSION); myContents.setVersion(VERSION); myRecords.putInt(HEADER_CONNECTION_STATUS_OFFSET, SAFELY_CLOSED_MAGIC); }
private static int getVersion() { final int recordsVersion = myRecords.getInt(HEADER_VERSION_OFFSET); if (myAttributes.getVersion() != recordsVersion || myContents.getVersion() != recordsVersion) return -1; return recordsVersion; }
public static boolean isDirty() { return myDirty || myNames.isDirty() || myAttributes.isDirty() || myContents.isDirty() || myRecords.isDirty(); }
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(); } }