JDK-8237508 : Simplify JarFile.isInitializing
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 11.0.7-oracle,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-01-19
  • Updated: 2020-06-04
  • Resolved: 2020-01-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14 JDK 15
11.0.7-oracleFixed 13.0.4Fixed 14.0.1Fixed 15 b07Fixed
Related Reports
Duplicate :  
Relates :  
Description
JDK-8234466 regress startup and footprint of very small applications noticeably.

Cause appears to be the addition of a lambda to JarFile.<clinit>. Since the value is only read rarely and only in one place, it could be simplified to use the default ThreadLocal initial value (null):

-    static final ThreadLocal<Boolean> isInitializing =
-            ThreadLocal.withInitial(() -> Boolean.FALSE);
+    static final ThreadLocal<Boolean> isInitializing = new ThreadLocal<>();
 
.. with adjustments in the places that read. This recuperates the startup regression.
Comments
Fix request (13u) I'd like to have it in 13u as well. Patch applies cleanly after JDK-8234466 and a single line break removal in a class declaration as done in JDK14 in JDK-8234335, with public class JarFile changed to public class JarFile I presume such a change doesn't require a discussion. tier1, tier2, tier3 tests passed.
04-06-2020

Fix Request (14u) this is a performance tweak to accompany JDK-8234466 which is already approved for JDK 14u
14-02-2020

Fix Request (11u) This is followup for backport of JDK-8234466, and it keeps codebases in sync (I see 11.0.8-oracle). Patch does not apply cleanly to 11u due to context changes. Passes tier1, tier2, tier3 after the fixes. 11u backport RFR (review done): https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-February/002447.html
06-02-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/c5203b158ec8 User: redestad Date: 2020-01-20 13:18:12 +0000
20-01-2020