mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8284161: Implementation of Virtual Threads (Preview)
Co-authored-by: Ron Pressler <rpressler@openjdk.org> Co-authored-by: Alan Bateman <alanb@openjdk.org> Co-authored-by: Erik Österlund <eosterlund@openjdk.org> Co-authored-by: Andrew Haley <aph@openjdk.org> Co-authored-by: Rickard Bäckman <rbackman@openjdk.org> Co-authored-by: Markus Grönlund <mgronlun@openjdk.org> Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org> Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org> Co-authored-by: Chris Plummer <cjplummer@openjdk.org> Co-authored-by: Coleen Phillimore <coleenp@openjdk.org> Co-authored-by: Robbin Ehn <rehn@openjdk.org> Co-authored-by: Stefan Karlsson <stefank@openjdk.org> Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org> Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org> Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
This commit is contained in:
parent
5212535a27
commit
9583e3657e
1133 changed files with 95935 additions and 8335 deletions
|
@ -27,6 +27,7 @@ package java.util.jar;
|
|||
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.internal.access.JavaUtilZipFileAccess;
|
||||
import jdk.internal.misc.ThreadTracker;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.util.ManifestEntryVerifier;
|
||||
|
||||
|
@ -44,10 +45,8 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
|
@ -150,7 +149,6 @@ public class JarFile extends ZipFile {
|
|||
private static final Runtime.Version RUNTIME_VERSION;
|
||||
private static final boolean MULTI_RELEASE_ENABLED;
|
||||
private static final boolean MULTI_RELEASE_FORCED;
|
||||
private static final ThreadLocal<Boolean> isInitializing = new ThreadLocal<>();
|
||||
// The maximum size of array to allocate. Some VMs reserve some header words in an array.
|
||||
private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
|
||||
|
||||
|
@ -1036,6 +1034,18 @@ public class JarFile extends ZipFile {
|
|||
}
|
||||
}
|
||||
|
||||
private static class ThreadTrackHolder {
|
||||
static final ThreadTracker TRACKER = new ThreadTracker();
|
||||
}
|
||||
|
||||
private static Object beginInit() {
|
||||
return ThreadTrackHolder.TRACKER.begin();
|
||||
}
|
||||
|
||||
private static void endInit(Object key) {
|
||||
ThreadTrackHolder.TRACKER.end(key);
|
||||
}
|
||||
|
||||
synchronized void ensureInitialization() {
|
||||
try {
|
||||
maybeInstantiateVerifier();
|
||||
|
@ -1043,19 +1053,18 @@ public class JarFile extends ZipFile {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
if (jv != null && !jvInitialized) {
|
||||
isInitializing.set(Boolean.TRUE);
|
||||
Object key = beginInit();
|
||||
try {
|
||||
initializeVerifier();
|
||||
jvInitialized = true;
|
||||
} finally {
|
||||
isInitializing.set(Boolean.FALSE);
|
||||
endInit(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isInitializing() {
|
||||
Boolean value = isInitializing.get();
|
||||
return (value == null) ? false : value;
|
||||
return ThreadTrackHolder.TRACKER.contains(Thread.currentThread());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue