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