Feature - RDestroyable interface extends AutoCloseable #5993 by ronitgupta138 · Pull Request #7397 · redisson/redisson · GitHub
Skip to content

Feature - RDestroyable interface extends AutoCloseable #5993 - #7397

Open
ronitgupta138 wants to merge 1 commit into
redisson:masterfrom
ronitgupta138:feat/rdestroyable-autocloseable
Open

ronitgupta138 wants to merge 1 commit into
redisson:masterfrom
ronitgupta138:feat/rdestroyable-autocloseable

Conversation

@ronitgupta138

Copy link
Copy Markdown
Contributor

Closes #5993

Objects implementing RDestroyable (such as RMapCache, RLocalCachedMap, RSetCache, RDelayedQueue, etc.) require explicit destruction to avoid leaking timer tasks, evictions, or listener subscriptions.

This PR makes RDestroyable extends AutoCloseable with a default method:

@Override
default void close() {
    destroy();
}
  • Enables standard Java try-with-resources across all RDestroyable structures without declaring checked exceptions.
  • 100% backwards-compatible with existing code invoking .destroy().
  • Added RDestroyableTest unit test.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 12:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Ronit Gupta <ronitgupta138@gmail.com>
@ronitgupta138
ronitgupta138 force-pushed the feat/rdestroyable-autocloseable branch from a2eea1c to 69bf91b Compare October 17, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

RDestroyable objects should also be AutoCloseable

2 participants