Class SnapshotSwapManager<T extends AutoCloseable>
java.lang.Object
org.impulsegraph.storage.csr.SnapshotSwapManager<T>
- All Implemented Interfaces:
AutoCloseable
Generic thread-safe A/B pointer swap manager for off-heap graph containers
(
RelationSnapshot and GraphSnapshot). Tracks active readers
per epoch so old off-heap Arenas can be safely closed.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSnapshotSwapManager.Holder<T extends AutoCloseable> -
Constructor Summary
ConstructorsConstructorDescriptionSnapshotSwapManager(T initialResource) SnapshotSwapManager(T initialResource, long swapDrainTimeout, long closeDrainTimeout, TimeUnit unit, Consumer<Throwable> errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionObtains the current resource and increments its reader reference count.voidclose()voidAtomically swaps the active resource to a new instance and schedules bounded draining and closing of the previous one.
-
Constructor Details
-
SnapshotSwapManager
-
SnapshotSwapManager
-
-
Method Details
-
acquireCurrent
Obtains the current resource and increments its reader reference count. The caller MUST invokeSnapshotSwapManager.Holder.release()when finished reading. -
getCurrent
-
swap
Atomically swaps the active resource to a new instance and schedules bounded draining and closing of the previous one. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-