< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page

  45 import java.net.URL;
  46 import java.nio.channels.Channel;
  47 import java.nio.channels.spi.SelectorProvider;
  48 import java.nio.charset.CharacterCodingException;
  49 import java.nio.charset.Charset;
  50 import java.security.AccessController;
  51 import java.security.CodeSource;
  52 import java.security.PrivilegedAction;
  53 import java.security.ProtectionDomain;
  54 import java.util.Collections;
  55 import java.util.List;
  56 import java.util.Locale;
  57 import java.util.Map;
  58 import java.util.Objects;
  59 import java.util.Properties;
  60 import java.util.PropertyPermission;
  61 import java.util.ResourceBundle;
  62 import java.util.Set;
  63 import java.util.WeakHashMap;
  64 import java.util.concurrent.Executor;

  65 import java.util.function.Supplier;
  66 import java.util.concurrent.ConcurrentHashMap;
  67 import java.util.stream.Stream;
  68 
  69 import jdk.internal.javac.Restricted;
  70 import jdk.internal.loader.NativeLibraries;
  71 import jdk.internal.logger.LoggerFinderLoader.TemporaryLoggerFinder;
  72 import jdk.internal.misc.Blocker;
  73 import jdk.internal.misc.CarrierThreadLocal;
  74 import jdk.internal.util.StaticProperty;
  75 import jdk.internal.module.ModuleBootstrap;
  76 import jdk.internal.module.ServicesCatalog;
  77 import jdk.internal.reflect.CallerSensitive;
  78 import jdk.internal.reflect.Reflection;
  79 import jdk.internal.access.JavaLangAccess;
  80 import jdk.internal.access.SharedSecrets;
  81 import jdk.internal.logger.LoggerFinderLoader;
  82 import jdk.internal.logger.LazyLoggers;
  83 import jdk.internal.logger.LocalizedLoggerWrapper;
  84 import jdk.internal.misc.VM;

2409                 Thread thread = Thread.currentThread();
2410                 if (thread instanceof BaseVirtualThread vthread) {
2411                     vthread.parkNanos(nanos);
2412                 } else {
2413                     throw new WrongThreadException();
2414                 }
2415             }
2416 
2417             public void unparkVirtualThread(Thread thread) {
2418                 if (thread instanceof BaseVirtualThread vthread) {
2419                     vthread.unpark();
2420                 } else {
2421                     throw new WrongThreadException();
2422                 }
2423             }
2424 
2425             public Executor virtualThreadDefaultScheduler() {
2426                 return VirtualThread.defaultScheduler();
2427             }
2428 




2429             public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2430                                                       ContinuationScope contScope,
2431                                                       Continuation continuation) {
2432                 return StackWalker.newInstance(options, null, contScope, continuation);
2433             }
2434 
2435             public String getLoaderNameID(ClassLoader loader) {
2436                 return loader != null ? loader.nameAndId() : "null";
2437             }
2438 
2439             @Override
2440             public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2441                 string.copyToSegmentRaw(segment, offset);
2442             }
2443 
2444             @Override
2445             public boolean bytesCompatible(String string, Charset charset) {
2446                 return string.bytesCompatible(charset);
2447             }
2448         });

  45 import java.net.URL;
  46 import java.nio.channels.Channel;
  47 import java.nio.channels.spi.SelectorProvider;
  48 import java.nio.charset.CharacterCodingException;
  49 import java.nio.charset.Charset;
  50 import java.security.AccessController;
  51 import java.security.CodeSource;
  52 import java.security.PrivilegedAction;
  53 import java.security.ProtectionDomain;
  54 import java.util.Collections;
  55 import java.util.List;
  56 import java.util.Locale;
  57 import java.util.Map;
  58 import java.util.Objects;
  59 import java.util.Properties;
  60 import java.util.PropertyPermission;
  61 import java.util.ResourceBundle;
  62 import java.util.Set;
  63 import java.util.WeakHashMap;
  64 import java.util.concurrent.Executor;
  65 import java.util.concurrent.ScheduledExecutorService;
  66 import java.util.function.Supplier;
  67 import java.util.concurrent.ConcurrentHashMap;
  68 import java.util.stream.Stream;
  69 
  70 import jdk.internal.javac.Restricted;
  71 import jdk.internal.loader.NativeLibraries;
  72 import jdk.internal.logger.LoggerFinderLoader.TemporaryLoggerFinder;
  73 import jdk.internal.misc.Blocker;
  74 import jdk.internal.misc.CarrierThreadLocal;
  75 import jdk.internal.util.StaticProperty;
  76 import jdk.internal.module.ModuleBootstrap;
  77 import jdk.internal.module.ServicesCatalog;
  78 import jdk.internal.reflect.CallerSensitive;
  79 import jdk.internal.reflect.Reflection;
  80 import jdk.internal.access.JavaLangAccess;
  81 import jdk.internal.access.SharedSecrets;
  82 import jdk.internal.logger.LoggerFinderLoader;
  83 import jdk.internal.logger.LazyLoggers;
  84 import jdk.internal.logger.LocalizedLoggerWrapper;
  85 import jdk.internal.misc.VM;

2410                 Thread thread = Thread.currentThread();
2411                 if (thread instanceof BaseVirtualThread vthread) {
2412                     vthread.parkNanos(nanos);
2413                 } else {
2414                     throw new WrongThreadException();
2415                 }
2416             }
2417 
2418             public void unparkVirtualThread(Thread thread) {
2419                 if (thread instanceof BaseVirtualThread vthread) {
2420                     vthread.unpark();
2421                 } else {
2422                     throw new WrongThreadException();
2423                 }
2424             }
2425 
2426             public Executor virtualThreadDefaultScheduler() {
2427                 return VirtualThread.defaultScheduler();
2428             }
2429 
2430             public Stream<ScheduledExecutorService> virtualThreadDelayedTaskSchedulers() {
2431                 return VirtualThread.delayedTaskSchedulers();
2432             }
2433 
2434             public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2435                                                       ContinuationScope contScope,
2436                                                       Continuation continuation) {
2437                 return StackWalker.newInstance(options, null, contScope, continuation);
2438             }
2439 
2440             public String getLoaderNameID(ClassLoader loader) {
2441                 return loader != null ? loader.nameAndId() : "null";
2442             }
2443 
2444             @Override
2445             public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2446                 string.copyToSegmentRaw(segment, offset);
2447             }
2448 
2449             @Override
2450             public boolean bytesCompatible(String string, Charset charset) {
2451                 return string.bytesCompatible(charset);
2452             }
2453         });
< prev index next >