< 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;

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




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

  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;

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