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