< prev index next >

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

Print this page

  23  * questions.
  24  */
  25 package java.lang;
  26 
  27 import java.io.BufferedInputStream;
  28 import java.io.BufferedOutputStream;
  29 import java.io.Console;
  30 import java.io.FileDescriptor;
  31 import java.io.FileInputStream;
  32 import java.io.FileOutputStream;
  33 import java.io.IOException;
  34 import java.io.InputStream;
  35 import java.io.OutputStream;
  36 import java.io.PrintStream;
  37 import java.lang.annotation.Annotation;
  38 import java.lang.foreign.MemorySegment;
  39 import java.lang.invoke.MethodHandle;
  40 import java.lang.invoke.MethodType;
  41 import java.lang.invoke.StringConcatFactory;
  42 import java.lang.module.ModuleDescriptor;

  43 import java.lang.reflect.Constructor;
  44 import java.lang.reflect.Executable;
  45 import java.lang.reflect.Method;
  46 import java.lang.reflect.Modifier;
  47 import java.net.URI;
  48 import java.net.URL;
  49 import java.nio.channels.Channel;
  50 import java.nio.channels.spi.SelectorProvider;
  51 import java.nio.charset.CharacterCodingException;
  52 import java.nio.charset.Charset;
  53 import java.security.AccessControlContext;
  54 import java.security.AccessController;
  55 import java.security.CodeSource;
  56 import java.security.PrivilegedAction;
  57 import java.security.ProtectionDomain;
  58 import java.util.Collections;
  59 import java.util.List;
  60 import java.util.Locale;
  61 import java.util.Map;
  62 import java.util.Objects;

2764             }
2765 
2766             public void unparkVirtualThread(Thread thread) {
2767                 if (thread instanceof BaseVirtualThread vthread) {
2768                     vthread.unpark();
2769                 } else {
2770                     throw new WrongThreadException();
2771                 }
2772             }
2773 
2774             public Executor virtualThreadDefaultScheduler() {
2775                 return VirtualThread.defaultScheduler();
2776             }
2777 
2778             public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2779                                                       ContinuationScope contScope,
2780                                                       Continuation continuation) {
2781                 return StackWalker.newInstance(options, null, contScope, continuation);
2782             }
2783 




2784             public String getLoaderNameID(ClassLoader loader) {
2785                 return loader != null ? loader.nameAndId() : "null";
2786             }
2787 
2788             @Override
2789             public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2790                 string.copyToSegmentRaw(segment, offset);
2791             }
2792 
2793             @Override
2794             public boolean bytesCompatible(String string, Charset charset) {
2795                 return string.bytesCompatible(charset);
2796             }
2797 
2798             @Override
2799             public boolean allowSecurityManager() {
2800                 return System.allowSecurityManager();
2801             }
2802         });
2803     }

  23  * questions.
  24  */
  25 package java.lang;
  26 
  27 import java.io.BufferedInputStream;
  28 import java.io.BufferedOutputStream;
  29 import java.io.Console;
  30 import java.io.FileDescriptor;
  31 import java.io.FileInputStream;
  32 import java.io.FileOutputStream;
  33 import java.io.IOException;
  34 import java.io.InputStream;
  35 import java.io.OutputStream;
  36 import java.io.PrintStream;
  37 import java.lang.annotation.Annotation;
  38 import java.lang.foreign.MemorySegment;
  39 import java.lang.invoke.MethodHandle;
  40 import java.lang.invoke.MethodType;
  41 import java.lang.invoke.StringConcatFactory;
  42 import java.lang.module.ModuleDescriptor;
  43 import java.lang.reflect.ClassFileFormatVersion;
  44 import java.lang.reflect.Constructor;
  45 import java.lang.reflect.Executable;
  46 import java.lang.reflect.Method;
  47 import java.lang.reflect.Modifier;
  48 import java.net.URI;
  49 import java.net.URL;
  50 import java.nio.channels.Channel;
  51 import java.nio.channels.spi.SelectorProvider;
  52 import java.nio.charset.CharacterCodingException;
  53 import java.nio.charset.Charset;
  54 import java.security.AccessControlContext;
  55 import java.security.AccessController;
  56 import java.security.CodeSource;
  57 import java.security.PrivilegedAction;
  58 import java.security.ProtectionDomain;
  59 import java.util.Collections;
  60 import java.util.List;
  61 import java.util.Locale;
  62 import java.util.Map;
  63 import java.util.Objects;

2765             }
2766 
2767             public void unparkVirtualThread(Thread thread) {
2768                 if (thread instanceof BaseVirtualThread vthread) {
2769                     vthread.unpark();
2770                 } else {
2771                     throw new WrongThreadException();
2772                 }
2773             }
2774 
2775             public Executor virtualThreadDefaultScheduler() {
2776                 return VirtualThread.defaultScheduler();
2777             }
2778 
2779             public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
2780                                                       ContinuationScope contScope,
2781                                                       Continuation continuation) {
2782                 return StackWalker.newInstance(options, null, contScope, continuation);
2783             }
2784 
2785             public int classFileFormatVersion(Class<?> clazz) {
2786                 return clazz.getClassFileVersion();
2787             }
2788 
2789             public String getLoaderNameID(ClassLoader loader) {
2790                 return loader != null ? loader.nameAndId() : "null";
2791             }
2792 
2793             @Override
2794             public void copyToSegmentRaw(String string, MemorySegment segment, long offset) {
2795                 string.copyToSegmentRaw(segment, offset);
2796             }
2797 
2798             @Override
2799             public boolean bytesCompatible(String string, Charset charset) {
2800                 return string.bytesCompatible(charset);
2801             }
2802 
2803             @Override
2804             public boolean allowSecurityManager() {
2805                 return System.allowSecurityManager();
2806             }
2807         });
2808     }
< prev index next >