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

564     /**
565      * Removes the value of the current carrier thread's copy of a thread-local.
566      */
567     void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
568 
569     /**
570      * Returns the current thread's scoped values cache
571      */
572     Object[] scopedValueCache();
573 
574     /**
575      * Sets the current thread's scoped values cache
576      */
577     void setScopedValueCache(Object[] cache);
578 
579     /**
580      * Return the current thread's scoped value bindings.
581      */
582     Object scopedValueBindings();
583 










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










623      */
624     Executor virtualThreadDefaultScheduler();
625 
626     /**
627      * Creates a new StackWalker
628      */
629     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
630                                        ContinuationScope contScope,
631                                        Continuation continuation);
632     /**
633      * Returns '<loader-name>' @<id> if classloader has a name
634      * explicitly set otherwise <qualified-class-name> @<id>
635      */
636     String getLoaderNameID(ClassLoader loader);
637 
638     /**
639      * Copy the string bytes to an existing segment, avoiding intermediate copies.
640      */
641     void copyToSegmentRaw(String string, MemorySegment segment, long offset);
642 
643     /**
644      * 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.

563     /**
564      * Removes the value of the current carrier thread's copy of a thread-local.
565      */
566     void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
567 
568     /**
569      * Returns the current thread's scoped values cache
570      */
571     Object[] scopedValueCache();
572 
573     /**
574      * Sets the current thread's scoped values cache
575      */
576     void setScopedValueCache(Object[] cache);
577 
578     /**
579      * Return the current thread's scoped value bindings.
580      */
581     Object scopedValueBindings();
582 
583     /**
584      * Returns the native thread ID for the given platform thread or 0 if not set.
585      */
586     long nativeThreadID(Thread thread);
587 
588     /**
589      * Sets the native thread ID for the current platform thread.
590      */
591     void setThreadNativeID(long id);
592 
593     /**
594      * Returns the innermost mounted continuation
595      */
596     Continuation getContinuation(Thread thread);
597 
598     /**
599      * Sets the innermost mounted continuation
600      */
601     void setContinuation(Thread thread, Continuation continuation);
602 
603     /**
604      * The ContinuationScope of virtual thread continuations
605      */
606     ContinuationScope virtualThreadContinuationScope();
607 
608     /**
609      * Parks the current virtual thread.
610      * @throws WrongThreadException if the current thread is not a virtual thread
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      * Returns the scheduler for the given virtual thread.
642      */
643     Thread.VirtualThreadScheduler virtualThreadScheduler(Thread thread);
644 
645     /**
646      * Creates a new StackWalker
647      */
648     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
649                                        ContinuationScope contScope,
650                                        Continuation continuation);
651     /**
652      * Returns '<loader-name>' @<id> if classloader has a name
653      * explicitly set otherwise <qualified-class-name> @<id>
654      */
655     String getLoaderNameID(ClassLoader loader);
656 
657     /**
658      * Copy the string bytes to an existing segment, avoiding intermediate copies.
659      */
660     void copyToSegmentRaw(String string, MemorySegment segment, long offset);
661 
662     /**
663      * Are the string bytes compatible with the given charset?
< prev index next >