InMemorySnapshotCollector

Buffers every SimulationSnapshot emitted by a SimulationLifeCycleEmitters into an in-memory list for later batch processing.

Attach once before the simulation starts, call drain after completion to retrieve all snapshots, then close to detach from the emitters. AutoCloseable allows use in a try-with-resources block.

Thread-safety: the internal list is guarded by synchronized(this) so that multiple concurrent simulations writing to separate collectors do not interfere even if they share a parent scope.

Constructors

Link copied to clipboard
constructor(emitters: SimulationLifeCycleEmitters)

Functions

Link copied to clipboard
open override fun close()

Detaches this collector from all emitters. After closing, no further snapshots are collected. Any snapshots already buffered remain available via drain.

Link copied to clipboard

Returns all collected snapshots in emission order and clears the internal buffer.