< prev index next >

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

Print this page

 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.AccessControlContext;
 42 import java.security.ProtectionDomain;
 43 import java.util.List;
 44 import java.util.Map;
 45 import java.util.Set;
 46 import java.util.concurrent.ConcurrentHashMap;
 47 import java.util.concurrent.Executor;
 48 import java.util.concurrent.RejectedExecutionException;

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

579      * Parks the current virtual thread for up to the given waiting time.
580      * @param nanos the maximum number of nanoseconds to wait
581      * @throws WrongThreadException if the current thread is not a virtual thread
582      */
583     void parkVirtualThread(long nanos);
584 
585     /**
586      * Re-enables a virtual thread for scheduling. If the thread was parked then
587      * it will be unblocked, otherwise its next attempt to park will not block
588      * @param thread the virtual thread to unpark
589      * @throws IllegalArgumentException if the thread is not a virtual thread
590      * @throws RejectedExecutionException if the scheduler cannot accept a task
591      */
592     void unparkVirtualThread(Thread thread);
593 
594     /**
595      * Returns the virtual thread default scheduler.
596      */
597     Executor virtualThreadDefaultScheduler();
598 





599     /**
600      * Creates a new StackWalker
601      */
602     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
603                                        ContinuationScope contScope,
604                                        Continuation continuation);
605     /**
606      * Returns '<loader-name>' @<id> if classloader has a name
607      * explicitly set otherwise <qualified-class-name> @<id>
608      */
609     String getLoaderNameID(ClassLoader loader);
610 
611     /**
612      * Copy the string bytes to an existing segment, avoiding intermediate copies.
613      */
614     void copyToSegmentRaw(String string, MemorySegment segment, long offset);
615 
616     /**
617      * Are the string bytes compatible with the given charset?
618      */

 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.AccessControlContext;
 42 import java.security.ProtectionDomain;
 43 import java.util.List;
 44 import java.util.Map;
 45 import java.util.Set;
 46 import java.util.concurrent.ConcurrentHashMap;
 47 import java.util.concurrent.Executor;
 48 import java.util.concurrent.RejectedExecutionException;
 49 import java.util.concurrent.ScheduledExecutorService;
 50 import java.util.stream.Stream;
 51 
 52 import jdk.internal.loader.NativeLibraries;
 53 import jdk.internal.misc.CarrierThreadLocal;
 54 import jdk.internal.module.ServicesCatalog;
 55 import jdk.internal.reflect.ConstantPool;
 56 import jdk.internal.vm.Continuation;
 57 import jdk.internal.vm.ContinuationScope;
 58 import jdk.internal.vm.StackableScope;
 59 import jdk.internal.vm.ThreadContainer;
 60 import sun.reflect.annotation.AnnotationType;
 61 import sun.nio.ch.Interruptible;
 62 
 63 public interface JavaLangAccess {
 64 
 65     /**
 66      * Returns the list of {@code Method} objects for the declared public
 67      * methods of this class or interface that have the specified method name
 68      * and parameter types.
 69      */

580      * Parks the current virtual thread for up to the given waiting time.
581      * @param nanos the maximum number of nanoseconds to wait
582      * @throws WrongThreadException if the current thread is not a virtual thread
583      */
584     void parkVirtualThread(long nanos);
585 
586     /**
587      * Re-enables a virtual thread for scheduling. If the thread was parked then
588      * it will be unblocked, otherwise its next attempt to park will not block
589      * @param thread the virtual thread to unpark
590      * @throws IllegalArgumentException if the thread is not a virtual thread
591      * @throws RejectedExecutionException if the scheduler cannot accept a task
592      */
593     void unparkVirtualThread(Thread thread);
594 
595     /**
596      * Returns the virtual thread default scheduler.
597      */
598     Executor virtualThreadDefaultScheduler();
599 
600     /**
601      * Returns a stream of the delayed task schedulers used for virtual threads.
602      */
603     Stream<ScheduledExecutorService> virtualThreadDelayedTaskSchedulers();
604 
605     /**
606      * Creates a new StackWalker
607      */
608     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
609                                        ContinuationScope contScope,
610                                        Continuation continuation);
611     /**
612      * Returns '<loader-name>' @<id> if classloader has a name
613      * explicitly set otherwise <qualified-class-name> @<id>
614      */
615     String getLoaderNameID(ClassLoader loader);
616 
617     /**
618      * Copy the string bytes to an existing segment, avoiding intermediate copies.
619      */
620     void copyToSegmentRaw(String string, MemorySegment segment, long offset);
621 
622     /**
623      * Are the string bytes compatible with the given charset?
624      */
< prev index next >