tomcat
tomcat copied to clipboard
Issue 66195 observe mr jar system property
Observe if system property for MR JAR is available
- Check if the JVM system property for MR-JAR is set
- If set, parse the value as a boolean
- If set, and when `#isMultiRelease()` is invoked, return the configured
value
Refs #66195
https://bz.apache.org/bugzilla/show_bug.cgi?id=66195
Hi @nobeh ,
The JarFile#isMultiRelease method itself already implements the relevant logic, so we don't need to do anything extra with this property. In addition, we know from the documentation that the value of the jdk.util.jar.enableMultiRelease property is not just of the boolean type, but may also be force. So your implementation is also faulty.
already implements the relevant logic, so we don't need to do anything extra with this property
Yes, that's correct. However, Tomcat uses a "MethodHandle" invocation to call that method. When a system is under load, through profiling, we've observed that invoking the method handle to evaluate to false could actually be an expensive operation. This is one of the main motivations for this change.
but may also be force
Yes. Thanks for the catch. I will update this.
to evaluate to
falsecould actually be an expensive operation. This is one of the main motivations for this change.
And the root cause for that is because of a synchronized block:
https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/jar/JarFile.java#L999
The sync block won't be reached: https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/jar/JarFile.java#L382
The case hasn't been made that this change is necessary nor has any evidence been provided of a genuine performance improvement.