Skip to content

Add PersistenceShutdownReleasable opt-in shutdown-release contract - #305

Merged
fh-ms merged 1 commit into
mainfrom
shutdown-releasable
Jul 20, 2026
Merged

Add PersistenceShutdownReleasable opt-in shutdown-release contract#305
fh-ms merged 1 commit into
mainfrom
shutdown-releasable

Conversation

@fh-ms

@fh-ms fh-ms commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Introduces a marker interface for persisted instances that hold resources which must be released when their owning storage is shut down — background threads, off-heap buffers or auxiliary on-disk files that are not part of the storage's own data files and therefore are not reclaimed by shutting the storage down. On shutdown the storage manager enumerates its object registry (already-loaded instances only, so no Lazy subgraph is force-loaded) and invokes releaseOnShutdown() on every registered instance that implements this interface.

Participation is opt-in by design: a plain AutoCloseable is deliberately not triggered, so implementing this interface is an explicit statement that release-on-shutdown is desired. Implementations must be idempotent and must not throw for conditions the caller cannot act on, as the release pass is best-effort.

Introduces a marker interface for persisted instances that hold resources which must be released when their owning storage is shut down — background threads, off-heap buffers or auxiliary on-disk files that are not part of the storage's own data files and therefore are not reclaimed by shutting the storage down. On shutdown the storage manager enumerates its object registry (already-loaded instances only, so no Lazy subgraph is force-loaded) and invokes releaseOnShutdown() on every registered instance that implements this interface.

Participation is opt-in by design: a plain AutoCloseable is deliberately not triggered, so implementing this interface is an explicit statement that release-on-shutdown is desired. Implementations must be idempotent and must not throw for conditions the caller cannot act on, as the release pass is best-effort.
@fh-ms
fh-ms requested a review from zdenek-jonas July 20, 2026 12:21
@fh-ms
fh-ms merged commit 1de8a9b into main Jul 20, 2026
19 checks passed
@fh-ms
fh-ms deleted the shutdown-releasable branch July 20, 2026 12:41
@fh-ms fh-ms added this to the 4.2.0 milestone Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants