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

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










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










619      */
620     Executor virtualThreadDefaultScheduler();
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, int srcIndex, int srcLength);
638 
639     /**
640      * Are the string bytes compatible with the given charset?
641      */
642     boolean bytesCompatible(String string, Charset charset, int srcIndex, int numChars);






643 }

 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.

559     /**
560      * Removes the value of the current carrier thread's copy of a thread-local.
561      */
562     void removeCarrierThreadLocal(CarrierThreadLocal<?> local);
563 
564     /**
565      * Returns the current thread's scoped values cache
566      */
567     Object[] scopedValueCache();
568 
569     /**
570      * Sets the current thread's scoped values cache
571      */
572     void setScopedValueCache(Object[] cache);
573 
574     /**
575      * Return the current thread's scoped value bindings.
576      */
577     Object scopedValueBindings();
578 
579     /**
580      * Returns the native thread ID for the given platform thread or 0 if not set.
581      */
582     long nativeThreadID(Thread thread);
583 
584     /**
585      * Sets the native thread ID for the current platform thread.
586      */
587     void setThreadNativeID(long id);
588 
589     /**
590      * Returns the innermost mounted continuation
591      */
592     Continuation getContinuation(Thread thread);
593 
594     /**
595      * Sets the innermost mounted continuation
596      */
597     void setContinuation(Thread thread, Continuation continuation);
598 
599     /**
600      * The ContinuationScope of virtual thread continuations
601      */
602     ContinuationScope virtualThreadContinuationScope();
603 
604     /**
605      * Parks the current virtual thread.
606      * @throws WrongThreadException if the current thread is not a virtual thread
607      */
608     void parkVirtualThread();
609 
610     /**
611      * Parks the current virtual thread for up to the given waiting time.
612      * @param nanos the maximum number of nanoseconds to wait
613      * @throws WrongThreadException if the current thread is not a virtual thread
614      */
615     void parkVirtualThread(long nanos);
616 
617     /**
618      * Re-enables a virtual thread for scheduling. If the thread was parked then
619      * it will be unblocked, otherwise its next attempt to park will not block
620      * @param thread the virtual thread to unpark
621      * @throws IllegalArgumentException if the thread is not a virtual thread
622      * @throws RejectedExecutionException if the scheduler cannot accept a task
623      */
624     void unparkVirtualThread(Thread thread);
625 
626     /**
627      * Returns the builtin virtual thread scheduler.
628      */
629     Thread.VirtualThreadScheduler builtinVirtualThreadScheduler();
630 
631     /**
632      * Returns the default virtual thread scheduler.
633      */
634     Thread.VirtualThreadScheduler defaultVirtualThreadScheduler();
635 
636     /**
637      * Returns the scheduler for the given virtual thread.
638      */
639     Thread.VirtualThreadScheduler virtualThreadScheduler(Thread thread);
640 
641     /**
642      * Creates a new StackWalker
643      */
644     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
645                                        ContinuationScope contScope,
646                                        Continuation continuation);
647     /**
648      * Returns '<loader-name>' @<id> if classloader has a name
649      * explicitly set otherwise <qualified-class-name> @<id>
650      */
651     String getLoaderNameID(ClassLoader loader);
652 
653     /**
654      * Copy the string bytes to an existing segment, avoiding intermediate copies.
655      */
656     void copyToSegmentRaw(String string, MemorySegment segment, long offset, int srcIndex, int srcLength);
657 
658     /**
659      * Are the string bytes compatible with the given charset?
660      */
661     boolean bytesCompatible(String string, Charset charset, int srcIndex, int numChars);
662 
663 
664     /**
665      * Finish initialization of the StackTraceElement objects in a stack trace.
666      */
667     void finishInit(StackTraceElement[] stackTrace);
668 }
< prev index next >