Skip to content

8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner #25242

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

bchristi-git
Copy link
Member

@bchristi-git bchristi-git commented May 14, 2025

Please review this change to replace the finalizer in AbstractLdapNamingEnumeration with Cleaner.

(The first PR for this fix started some substantial discussions, leading to, among other things, the 8314480 java.lang.ref memory ordering spec update.)

In standard fashion, pieces of state required for cleanup (LdapCtx homeCtx, LdapResult res, and LdapClient enumClnt) are moved into a Context object. From there, the change is fairly mechanical.

Details of note:

  1. Some operations need to change the state values (the update() method is probably the most interesting). Use of reachabilityFence() ensures memory visibility on the Cleaner thread (per the aforementioned spec update).
  2. Subclasses need to access homeCtx; I added a homeCtx() method to read homeCtx from the superclass's state.

The test case is based on a copy of com/sun/jndi/ldap/blits/AddTests/AddNewEntry.java. It confirms that the use of Cleaner does not keep an LdapSearchEnumeration object reachable. The other AbstractLdapNamingEnumeration subclasses (LdapNamingEnumeration and LdapBindingEnumeration) can be expected to behave the same.

Thanks.

Edit: (Re)viewers: due to there being a lot of indentation changes, you might consider enabling the "Hide whitespace" option on the "Files changed" tab. To my eye, it gives a better view of the changes.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner (Sub-task - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25242/head:pull/25242
$ git checkout pull/25242

Update a local copy of the PR:
$ git checkout pull/25242
$ git pull https://git.openjdk.org/jdk.git pull/25242/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25242

View PR using the GUI difftool:
$ git pr show -t 25242

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25242.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 14, 2025

👋 Welcome back bchristi! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 14, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 14, 2025
@openjdk
Copy link

openjdk bot commented May 14, 2025

@bchristi-git The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label May 14, 2025
@mlbridge
Copy link

mlbridge bot commented May 14, 2025

Webrevs

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants