< prev index next >

src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java

Print this page

 26 package jdk.internal.access;
 27 
 28 import java.io.InputStream;
 29 import java.io.PrintStream;
 30 import java.lang.annotation.Annotation;
 31 import java.lang.foreign.MemorySegment;
 32 import java.lang.foreign.SymbolLookup;
 33 import java.lang.invoke.MethodHandle;
 34 import java.lang.invoke.MethodType;
 35 import java.lang.module.ModuleDescriptor;
 36 import java.lang.reflect.Executable;
 37 import java.lang.reflect.Method;
 38 import java.net.URI;
 39 import java.nio.charset.CharacterCodingException;
 40 import java.nio.charset.Charset;
 41 import java.security.ProtectionDomain;
 42 import java.util.List;
 43 import java.util.Map;
 44 import java.util.Set;
 45 import java.util.concurrent.ConcurrentHashMap;
 46 import java.util.concurrent.Executor;
 47 import java.util.concurrent.RejectedExecutionException;
 48 import java.util.stream.Stream;
 49 
 50 import jdk.internal.loader.NativeLibraries;
 51 import jdk.internal.misc.CarrierThreadLocal;
 52 import jdk.internal.module.ServicesCatalog;
 53 import jdk.internal.reflect.ConstantPool;
 54 import jdk.internal.vm.Continuation;
 55 import jdk.internal.vm.ContinuationScope;
 56 import jdk.internal.vm.StackableScope;
 57 import jdk.internal.vm.ThreadContainer;
 58 import sun.reflect.annotation.AnnotationType;
 59 import sun.nio.ch.Interruptible;
 60 
 61 public interface JavaLangAccess {
 62 
 63     /**
 64      * Returns the list of {@code Method} objects for the declared public
 65      * methods of this class or interface that have the specified method name
 66      * and parameter types.

597 
598     /**
599      * The ContinuationScope of virtual thread continuations
600      */
601     ContinuationScope virtualThreadContinuationScope();
602 
603     /**
604      * Parks the current virtual thread.
605      * @throws WrongThreadException if the current thread is not a virtual thread
606      */
607     void parkVirtualThread();
608 
609     /**
610      * Parks the current virtual thread for up to the given waiting time.
611      * @param nanos the maximum number of nanoseconds to wait
612      * @throws WrongThreadException if the current thread is not a virtual thread
613      */
614     void parkVirtualThread(long nanos);
615 
616     /**
617      * Re-enables a virtual thread for scheduling. If the thread was parked then
618      * it will be unblocked, otherwise its next attempt to park will not block
619      * @param thread the virtual thread to unpark
620      * @throws IllegalArgumentException if the thread is not a virtual thread
621      * @throws RejectedExecutionException if the scheduler cannot accept a task
622      */
623     void unparkVirtualThread(Thread thread);
624 
625     /**
626      * Returns the virtual thread default scheduler.
627      */
628     Executor virtualThreadDefaultScheduler();





629 
630     /**
631      * Creates a new StackWalker
632      */
633     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
634                                        ContinuationScope contScope,
635                                        Continuation continuation);
636     /**
637      * Returns '<loader-name>' @<id> if classloader has a name
638      * explicitly set otherwise <qualified-class-name> @<id>
639      */
640     String getLoaderNameID(ClassLoader loader);
641 
642     /**
643      * Copy the string bytes to an existing segment, avoiding intermediate copies.
644      */
645     void copyToSegmentRaw(String string, MemorySegment segment, long offset, int srcIndex, int srcLength);
646 
647     /**
648      * Are the string bytes compatible with the given charset?

 26 package jdk.internal.access;
 27 
 28 import java.io.InputStream;
 29 import java.io.PrintStream;
 30 import java.lang.annotation.Annotation;
 31 import java.lang.foreign.MemorySegment;
 32 import java.lang.foreign.SymbolLookup;
 33 import java.lang.invoke.MethodHandle;
 34 import java.lang.invoke.MethodType;
 35 import java.lang.module.ModuleDescriptor;
 36 import java.lang.reflect.Executable;
 37 import java.lang.reflect.Method;
 38 import java.net.URI;
 39 import java.nio.charset.CharacterCodingException;
 40 import java.nio.charset.Charset;
 41 import java.security.ProtectionDomain;
 42 import java.util.List;
 43 import java.util.Map;
 44 import java.util.Set;
 45 import java.util.concurrent.ConcurrentHashMap;

 46 import java.util.concurrent.RejectedExecutionException;
 47 import java.util.stream.Stream;
 48 
 49 import jdk.internal.loader.NativeLibraries;
 50 import jdk.internal.misc.CarrierThreadLocal;
 51 import jdk.internal.module.ServicesCatalog;
 52 import jdk.internal.reflect.ConstantPool;
 53 import jdk.internal.vm.Continuation;
 54 import jdk.internal.vm.ContinuationScope;
 55 import jdk.internal.vm.StackableScope;
 56 import jdk.internal.vm.ThreadContainer;
 57 import sun.reflect.annotation.AnnotationType;
 58 import sun.nio.ch.Interruptible;
 59 
 60 public interface JavaLangAccess {
 61 
 62     /**
 63      * Returns the list of {@code Method} objects for the declared public
 64      * methods of this class or interface that have the specified method name
 65      * and parameter types.

596 
597     /**
598      * The ContinuationScope of virtual thread continuations
599      */
600     ContinuationScope virtualThreadContinuationScope();
601 
602     /**
603      * Parks the current virtual thread.
604      * @throws WrongThreadException if the current thread is not a virtual thread
605      */
606     void parkVirtualThread();
607 
608     /**
609      * Parks the current virtual thread for up to the given waiting time.
610      * @param nanos the maximum number of nanoseconds to wait
611      * @throws WrongThreadException if the current thread is not a virtual thread
612      */
613     void parkVirtualThread(long nanos);
614 
615     /**
616      * Re-enables a virtual thread for scheduling. If the thread is parked then it will
617      * be scheduled to continue, otherwise its next attempt to park will not block.
618      * @param thread the virtual thread to unpark
619      * @throws IllegalArgumentException if the thread is not a virtual thread
620      * @throws RejectedExecutionException if the scheduler cannot accept a task
621      */
622     void unparkVirtualThread(Thread thread);
623 
624     /**
625      * Returns the builtin virtual thread scheduler.
626      */
627     Thread.VirtualThreadScheduler builtinVirtualThreadScheduler();
628 
629     /**
630      * Returns the default virtual thread scheduler.
631      */
632     Thread.VirtualThreadScheduler defaultVirtualThreadScheduler();
633 
634     /**
635      * Creates a new StackWalker
636      */
637     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
638                                        ContinuationScope contScope,
639                                        Continuation continuation);
640     /**
641      * Returns '<loader-name>' @<id> if classloader has a name
642      * explicitly set otherwise <qualified-class-name> @<id>
643      */
644     String getLoaderNameID(ClassLoader loader);
645 
646     /**
647      * Copy the string bytes to an existing segment, avoiding intermediate copies.
648      */
649     void copyToSegmentRaw(String string, MemorySegment segment, long offset, int srcIndex, int srcLength);
650 
651     /**
652      * Are the string bytes compatible with the given charset?
< prev index next >