< 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.

553     /**
554      * Removes the value of the current carrier thread's copy of a thread-local.
555      */
556     void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
557 
558     /**
559      * Returns the current thread's scoped values cache
560      */
561     Object[] scopedValueCache();
562 
563     /**
564      * Sets the current thread's scoped values cache
565      */
566     void setScopedValueCache(Object[] cache);
567 
568     /**
569      * Return the current thread's scoped value bindings.
570      */
571     Object scopedValueBindings();
572 










573     /**
574      * Returns the innermost mounted continuation
575      */
576     Continuation getContinuation(Thread thread);
577 
578     /**
579      * Sets the innermost mounted continuation
580      */
581     void setContinuation(Thread thread, Continuation continuation);
582 
583     /**
584      * The ContinuationScope of virtual thread continuations
585      */
586     ContinuationScope virtualThreadContinuationScope();
587 
588     /**
589      * Parks the current virtual thread.
590      * @throws WrongThreadException if the current thread is not a virtual thread
591      */
592     void parkVirtualThread();
593 
594     /**
595      * Parks the current virtual thread for up to the given waiting time.
596      * @param nanos the maximum number of nanoseconds to wait
597      * @throws WrongThreadException if the current thread is not a virtual thread
598      */
599     void parkVirtualThread(long nanos);
600 
601     /**
602      * Re-enables a virtual thread for scheduling. If the thread was parked then
603      * it will be unblocked, otherwise its next attempt to park will not block
604      * @param thread the virtual thread to unpark
605      * @throws IllegalArgumentException if the thread is not a virtual thread
606      * @throws RejectedExecutionException if the scheduler cannot accept a task
607      */
608     void unparkVirtualThread(Thread thread);
609 
610     /**
611      * Returns the virtual thread default scheduler.










612      */
613     Executor virtualThreadDefaultScheduler();
614 
615     /**
616      * Creates a new StackWalker
617      */
618     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
619                                        ContinuationScope contScope,
620                                        Continuation continuation);
621     /**
622      * Returns '<loader-name>' @<id> if classloader has a name
623      * explicitly set otherwise <qualified-class-name> @<id>
624      */
625     String getLoaderNameID(ClassLoader loader);
626 
627     /**
628      * Copy the string bytes to an existing segment, avoiding intermediate copies.
629      */
630     void copyToSegmentRaw(String string, MemorySegment segment, long offset);
631 
632     /**
633      * 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.

552     /**
553      * Removes the value of the current carrier thread's copy of a thread-local.
554      */
555     void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
556 
557     /**
558      * Returns the current thread's scoped values cache
559      */
560     Object[] scopedValueCache();
561 
562     /**
563      * Sets the current thread's scoped values cache
564      */
565     void setScopedValueCache(Object[] cache);
566 
567     /**
568      * Return the current thread's scoped value bindings.
569      */
570     Object scopedValueBindings();
571 
572     /**
573      * Returns the native thread ID for the given platform thread or 0 if not set.
574      */
575     long nativeThreadID(Thread thread);
576 
577     /**
578      * Sets the native thread ID for the current platform thread.
579      */
580     void setThreadNativeID(long id);
581 
582     /**
583      * Returns the innermost mounted continuation
584      */
585     Continuation getContinuation(Thread thread);
586 
587     /**
588      * Sets the innermost mounted continuation
589      */
590     void setContinuation(Thread thread, Continuation continuation);
591 
592     /**
593      * The ContinuationScope of virtual thread continuations
594      */
595     ContinuationScope virtualThreadContinuationScope();
596 
597     /**
598      * Parks the current virtual thread.
599      * @throws WrongThreadException if the current thread is not a virtual thread
600      */
601     void parkVirtualThread();
602 
603     /**
604      * Parks the current virtual thread for up to the given waiting time.
605      * @param nanos the maximum number of nanoseconds to wait
606      * @throws WrongThreadException if the current thread is not a virtual thread
607      */
608     void parkVirtualThread(long nanos);
609 
610     /**
611      * Re-enables a virtual thread for scheduling. If the thread was parked then
612      * it will be unblocked, otherwise its next attempt to park will not block
613      * @param thread the virtual thread to unpark
614      * @throws IllegalArgumentException if the thread is not a virtual thread
615      * @throws RejectedExecutionException if the scheduler cannot accept a task
616      */
617     void unparkVirtualThread(Thread thread);
618 
619     /**
620      * Returns the default virtual thread scheduler.
621      */
622     Thread.VirtualThreadScheduler defaultVirtualThreadScheduler();
623 
624     /**
625      * Returns true if using a custom default virtual thread scheduler.
626      */
627     boolean isCustomDefaultVirtualThreadScheduler();
628 
629     /**
630      * Returns the scheduler for the given virtual thread.
631      */
632     Thread.VirtualThreadScheduler virtualThreadScheduler(Thread thread);
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);
650 
651     /**
652      * Are the string bytes compatible with the given charset?
< prev index next >