-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add register to CleanupReferenceProcessor #6213
feat: Add register to CleanupReferenceProcessor #6213
Conversation
This is inspired by `java.lang.ref.Cleaner#register` which makes it very easy for callers to associate a cleanup action with an object without needing to deal with a Reference or ReferenceQueue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run nightlies if you haven't.
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/reference/CleanupReferenceProcessor.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Override | ||
public void cleanup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use interface defaulting to avoid this duplication....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there was more complex logic, I would consider it. In this case, I think per-impl is pretty straightforward.
running nightlies now... |
This is inspired by
java.lang.ref.Cleaner#register
which makes it very easy for callers to associate a cleanup action with an object without needing to deal with a Reference or ReferenceQueue.