< prev index next >

src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java

Print this page
*** 41,22 ***
  import java.security.ProtectionDomain;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  import java.util.concurrent.ConcurrentHashMap;
- import java.util.concurrent.Executor;
  import java.util.concurrent.RejectedExecutionException;
  import java.util.stream.Stream;
  
  import jdk.internal.loader.NativeLibraries;
  import jdk.internal.misc.CarrierThreadLocal;
  import jdk.internal.module.ServicesCatalog;
  import jdk.internal.reflect.ConstantPool;
  import jdk.internal.vm.Continuation;
  import jdk.internal.vm.ContinuationScope;
  import jdk.internal.vm.StackableScope;
  import jdk.internal.vm.ThreadContainer;
  import sun.reflect.annotation.AnnotationType;
  import sun.nio.ch.Interruptible;
  
  public interface JavaLangAccess {
  
--- 41,23 ---
  import java.security.ProtectionDomain;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.concurrent.RejectedExecutionException;
+ import java.util.function.Supplier;
  import java.util.stream.Stream;
  
  import jdk.internal.loader.NativeLibraries;
  import jdk.internal.misc.CarrierThreadLocal;
  import jdk.internal.module.ServicesCatalog;
  import jdk.internal.reflect.ConstantPool;
  import jdk.internal.vm.Continuation;
  import jdk.internal.vm.ContinuationScope;
  import jdk.internal.vm.StackableScope;
  import jdk.internal.vm.ThreadContainer;
+ import sun.nio.ch.NativeThread;
  import sun.reflect.annotation.AnnotationType;
  import sun.nio.ch.Interruptible;
  
  public interface JavaLangAccess {
  

*** 559,10 ***
--- 560,20 ---
      /**
       * Return the current thread's scoped value bindings.
       */
      Object scopedValueBindings();
  
+     /**
+      * Returns the NativeThread for signalling, null if not set.
+      */
+     NativeThread nativeThread(Thread thread);
+ 
+     /**
+      * Sets the NativeThread for the current platform thread.
+      */
+     void setNativeThread(NativeThread nt);
+ 
      /**
       * Returns the innermost mounted continuation
       */
      Continuation getContinuation(Thread thread);
  

*** 597,13 ***
       * @throws RejectedExecutionException if the scheduler cannot accept a task
       */
      void unparkVirtualThread(Thread thread);
  
      /**
!      * Returns the virtual thread default scheduler.
       */
!     Executor virtualThreadDefaultScheduler();
  
      /**
       * Creates a new StackWalker
       */
      StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
--- 608,31 ---
       * @throws RejectedExecutionException if the scheduler cannot accept a task
       */
      void unparkVirtualThread(Thread thread);
  
      /**
!      * Returns the default virtual thread scheduler.
+      */
+     Thread.VirtualThreadScheduler defaultVirtualThreadScheduler();
+ 
+     /**
+      * Returns true if using a custom default virtual thread scheduler.
+      */
+     boolean isCustomDefaultVirtualThreadScheduler();
+ 
+     /**
+      * Returns the scheduler for the given virtual thread.
+      */
+     Thread.VirtualThreadScheduler virtualThreadScheduler(Thread thread);
+ 
+     /**
+      * Invokes a supplier to produce a non-null result if this virtual thread is not mounted.
+      * @param supplier1 invoked if this virtual thread is alive and unmounted
+      * @param supplier2 invoked if this virtual thread is not alive
+      * @return the result; {@code null} if this virtual thread is mounted or in transition
       */
!     <T> T supplyIfUnmounted(Thread thread, Supplier<T> supplier1, Supplier<T> supplier2);
  
      /**
       * Creates a new StackWalker
       */
      StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
< prev index next >