Skip to content

Commit

Permalink
Merge pull request payara#6713 from flowlogix/optimize-mr-jar
Browse files Browse the repository at this point in the history
FISH-8688 improvement: optimize MR-jar class loading
  • Loading branch information
Pandrex247 committed Jun 19, 2024
1 parent 0478424 commit 940da8e
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2023] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.loader;

Expand Down Expand Up @@ -95,6 +95,7 @@ These variables cannot be nulled out because of this, but the contents are clear

/** logger for this class */
private static final Logger _logger = CULoggerInfo.getLogger();
private static final Runtime.Version RUNTIME_VERSION = Runtime.Version.parse(System.getProperty("java.version"));

/*
list of url entries of this class loader. Using LinkedHashSet instead of original ArrayList
Expand Down Expand Up @@ -613,12 +614,9 @@ private byte[] loadClassData0(final URLEntry res, final String entryName) {
return AccessController.doPrivileged((PrivilegedAction<byte[]>) () -> {
try {
if (res.isJar) { // It is a jarfile..
JarFile zip = res.zip;
JarFile jar = new JarFile(res.file, false, JarFile.OPEN_READ,
Runtime.Version.parse(System.getProperty("java.version")));
JarEntry entry = jar.getJarEntry(entryName);
JarEntry entry = res.zip.getJarEntry(entryName);
if (entry != null) {
byte[] classData = getClassData(zip.getInputStream(entry));
byte[] classData = getClassData(res.zip.getInputStream(entry));
res.setProtectionDomain(ASURLClassLoader.this, entry.getCertificates());
return classData;
}
Expand Down Expand Up @@ -899,7 +897,7 @@ private static final class ProtectedJarFile extends JarFile {
* @throws IOException from parent
*/
public ProtectedJarFile(File file) throws IOException {
super(file);
super(file, true, OPEN_READ, RUNTIME_VERSION);
registerCloseEvent();
}

Expand Down

0 comments on commit 940da8e

Please sign in to comment.