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
8052260: Reference.isEnqueued() spec does not match the long-standing behavior returning true iff it's in the ref queue #1684
Conversation
… behavior returning true iff it's in the ref queue
👋 Welcome back mchung! A progress list of the required criteria for merging this PR into |
/csr |
@mlchung this pull request will not be integrated until the CSR request JDK-8189386 for issue JDK-8052260 has been approved. |
Webrevs
|
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.
This change looks good. There are a couple of tests that are using isEnqueued.
vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java
jdk/java/lang/ref/ReferenceEnqueue.java
https://bugs.openjdk.java.net/browse/JDK-8257876
(I'm working on this.)
Thanks, Kim. It's good to update the tests (thanks for working on it). |
@mlchung This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 16 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
* @deprecated | ||
* This method was never implemented to test if a reference object has | ||
* been cleared and enqueued as it was previously specified since 1.2. | ||
* This method could be misused due to the inherent race condition |
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.
A small suggestion is to restructure the first sentence of the deprecated message to say "This method was originally specified to test .. but was never implemented to do this test", otherwise looks okay.
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.
Yes, it reads better and we can also drop "as it was previously specified since 1.2".
* This method was originally specified to test if a reference object has
* been cleared and enqueued but was never implemented to do this test.
/integrate |
@mlchung Since your change was applied there have been 22 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 5f03341. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Reference::isEnqueued
method was never implemented as it was initially specified since 1.2. The specification says that it tests if this reference object has been enqueued, but the long-standing behavior is to test if this reference object is in its associated queue, only reflecting the state at the time when this method is executed. The implementation doesn't do what the specification promised, which might cause serious bugs if unnoticed. For example, an application that relies on this method to release critical resources could cause serious performance issues, in particular when this method is misused on Reference objects without an associated queue.Reference::refersTo(null)
is the better recommended way to test if a Reference object has been cleared.This proposes to deprecate
Reference::isEnqueued
. Also the spec is updated to match the long-standing behavior.CSR: https://bugs.openjdk.java.net/browse/JDK-8189386
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1684/head:pull/1684
$ git checkout pull/1684