< prev index next >

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

Print this page
*** 41,13 ***
  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.function.BiFunction;
  import java.util.stream.Stream;
  
  import jdk.internal.loader.NativeLibraries;
  import jdk.internal.misc.CarrierThreadLocal;
  import jdk.internal.module.ServicesCatalog;
--- 41,12 ---
  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;

*** 571,10 ***
--- 570,20 ---
      /**
       * Return the current thread's scoped value bindings.
       */
      Object scopedValueBindings();
  
+     /**
+      * Returns the native thread ID for the given platform thread or 0 if not set.
+      */
+     long nativeThreadID(Thread thread);
+ 
+     /**
+      * Sets the native thread ID for the current platform thread.
+      */
+     void setThreadNativeID(long id);
+ 
      /**
       * Returns the innermost mounted continuation
       */
      Continuation getContinuation(Thread thread);
  

*** 609,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,
--- 618,32 ---
       * @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 unmounted.
+      * @param supplyIfAlive invoked if this virtual thread is unmounted and alive. The
+      *      virtual thread is suspended while the supplier executes
+      * @param supplyIfNotAlive invoked if this virtual thread is not alive
+      * @return the result; {@code null} if mounted, suspended or in transition
       */
!     <T> T supplyIfUnmounted(Thread thread, Supplier<T> supplyIfAlive, Supplier<T> supplyIfNotAlive);
  
      /**
       * Creates a new StackWalker
       */
      StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
< prev index next >