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.
67 */
68 List<Method> getDeclaredPublicMethods(Class<?> klass, String name, Class<?>... parameterTypes);
69
70 /**
71 * Return most specific method that matches name and parameterTypes.
72 */
73 Method findMethod(Class<?> klass, boolean publicOnly, String name, Class<?>... parameterTypes);
74
75 /**
76 * Return the constant pool for a class.
77 */
544 /**
545 * Removes the value of the current carrier thread's copy of a thread-local.
546 */
547 void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
548
549 /**
550 * Returns the current thread's scoped values cache
551 */
552 Object[] scopedValueCache();
553
554 /**
555 * Sets the current thread's scoped values cache
556 */
557 void setScopedValueCache(Object[] cache);
558
559 /**
560 * Return the current thread's scoped value bindings.
561 */
562 Object scopedValueBindings();
563
564 /**
565 * Returns the innermost mounted continuation
566 */
567 Continuation getContinuation(Thread thread);
568
569 /**
570 * Sets the innermost mounted continuation
571 */
572 void setContinuation(Thread thread, Continuation continuation);
573
574 /**
575 * The ContinuationScope of virtual thread continuations
576 */
577 ContinuationScope virtualThreadContinuationScope();
578
579 /**
580 * Parks the current virtual thread.
581 * @throws WrongThreadException if the current thread is not a virtual thread
582 */
583 void parkVirtualThread();
586 * Parks the current virtual thread for up to the given waiting time.
587 * @param nanos the maximum number of nanoseconds to wait
588 * @throws WrongThreadException if the current thread is not a virtual thread
589 */
590 void parkVirtualThread(long nanos);
591
592 /**
593 * Re-enables a virtual thread for scheduling. If the thread was parked then
594 * it will be unblocked, otherwise its next attempt to park will not block
595 * @param thread the virtual thread to unpark
596 * @throws IllegalArgumentException if the thread is not a virtual thread
597 * @throws RejectedExecutionException if the scheduler cannot accept a task
598 */
599 void unparkVirtualThread(Thread thread);
600
601 /**
602 * Returns the virtual thread default scheduler.
603 */
604 Executor virtualThreadDefaultScheduler();
605
606 /**
607 * Creates a new StackWalker
608 */
609 StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
610 ContinuationScope contScope,
611 Continuation continuation);
612 /**
613 * Returns '<loader-name>' @<id> if classloader has a name
614 * explicitly set otherwise <qualified-class-name> @<id>
615 */
616 String getLoaderNameID(ClassLoader loader);
617
618 /**
619 * Copy the string bytes to an existing segment, avoiding intermediate copies.
620 */
621 void copyToSegmentRaw(String string, MemorySegment segment, long offset);
622
623 /**
624 * Are the string bytes compatible with the given charset?
625 */
|
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.nio.ch.NativeThread;
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 */
69 List<Method> getDeclaredPublicMethods(Class<?> klass, String name, Class<?>... parameterTypes);
70
71 /**
72 * Return most specific method that matches name and parameterTypes.
73 */
74 Method findMethod(Class<?> klass, boolean publicOnly, String name, Class<?>... parameterTypes);
75
76 /**
77 * Return the constant pool for a class.
78 */
545 /**
546 * Removes the value of the current carrier thread's copy of a thread-local.
547 */
548 void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
549
550 /**
551 * Returns the current thread's scoped values cache
552 */
553 Object[] scopedValueCache();
554
555 /**
556 * Sets the current thread's scoped values cache
557 */
558 void setScopedValueCache(Object[] cache);
559
560 /**
561 * Return the current thread's scoped value bindings.
562 */
563 Object scopedValueBindings();
564
565 /**
566 * Returns the NativeThread for signalling, null if not set.
567 */
568 NativeThread nativeThread(Thread thread);
569
570 /**
571 * Sets the NativeThread for the current platform thread.
572 */
573 void setNativeThread(NativeThread nt);
574
575 /**
576 * Returns the innermost mounted continuation
577 */
578 Continuation getContinuation(Thread thread);
579
580 /**
581 * Sets the innermost mounted continuation
582 */
583 void setContinuation(Thread thread, Continuation continuation);
584
585 /**
586 * The ContinuationScope of virtual thread continuations
587 */
588 ContinuationScope virtualThreadContinuationScope();
589
590 /**
591 * Parks the current virtual thread.
592 * @throws WrongThreadException if the current thread is not a virtual thread
593 */
594 void parkVirtualThread();
597 * Parks the current virtual thread for up to the given waiting time.
598 * @param nanos the maximum number of nanoseconds to wait
599 * @throws WrongThreadException if the current thread is not a virtual thread
600 */
601 void parkVirtualThread(long nanos);
602
603 /**
604 * Re-enables a virtual thread for scheduling. If the thread was parked then
605 * it will be unblocked, otherwise its next attempt to park will not block
606 * @param thread the virtual thread to unpark
607 * @throws IllegalArgumentException if the thread is not a virtual thread
608 * @throws RejectedExecutionException if the scheduler cannot accept a task
609 */
610 void unparkVirtualThread(Thread thread);
611
612 /**
613 * Returns the virtual thread default scheduler.
614 */
615 Executor virtualThreadDefaultScheduler();
616
617 /**
618 * Returns the scheduler for the given virtual thread.
619 */
620 Executor virtualThreadScheduler(Thread thread);
621
622 /**
623 * Creates a new StackWalker
624 */
625 StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
626 ContinuationScope contScope,
627 Continuation continuation);
628 /**
629 * Returns '<loader-name>' @<id> if classloader has a name
630 * explicitly set otherwise <qualified-class-name> @<id>
631 */
632 String getLoaderNameID(ClassLoader loader);
633
634 /**
635 * Copy the string bytes to an existing segment, avoiding intermediate copies.
636 */
637 void copyToSegmentRaw(String string, MemorySegment segment, long offset);
638
639 /**
640 * Are the string bytes compatible with the given charset?
641 */
|