mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
add pre-shutdown action to be executed inside ChronicleHashCloseOnExitHook.
This is useful when we want to do an orderly shutdown. For example: To carry out graceful shutdown and explicitly control when a ChronicleHash is closed, a pre-shutdown action can be a wait on a CountDownLatch that would be released appropriately.
This commit is contained in:
@@ -125,6 +125,7 @@ public abstract class VanillaChronicleHash<K,
|
||||
public transient CompactOffHeapLinearHashTable hashLookup;
|
||||
public transient Identity identity;
|
||||
protected int log2TiersInBulk;
|
||||
private Runnable preShutdownAction;
|
||||
/////////////////////////////////////////////////
|
||||
// Bytes Store (essentially, the base address) and serialization-dependent offsets
|
||||
protected transient BytesStore bs;
|
||||
@@ -208,6 +209,8 @@ public abstract class VanillaChronicleHash<K,
|
||||
tierBulkSizeInBytes = computeTierBulkBytesSize(tiersInBulk);
|
||||
|
||||
checksumEntries = privateAPI.checksumEntries();
|
||||
|
||||
preShutdownAction = privateAPI.getPreShutdownAction();
|
||||
}
|
||||
|
||||
public static IOException throwRecoveryOrReturnIOException(
|
||||
@@ -230,6 +233,10 @@ public abstract class VanillaChronicleHash<K,
|
||||
initTransients();
|
||||
}
|
||||
|
||||
public Runnable getPreShutdownAction() {
|
||||
return preShutdownAction;
|
||||
}
|
||||
|
||||
protected void readMarshallableFields(@NotNull WireIn wireIn) {
|
||||
dataFileVersion = wireIn.read(() -> "dataFileVersion").text();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user