< prev index next >

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

Print this page
@@ -38,15 +38,20 @@
  import java.security.AccessControlContext;
  import java.security.ProtectionDomain;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
+ import java.util.concurrent.Callable;
  import java.util.concurrent.ConcurrentHashMap;
+ import java.util.concurrent.RejectedExecutionException;
  import java.util.stream.Stream;
  
  import jdk.internal.module.ServicesCatalog;
  import jdk.internal.reflect.ConstantPool;
+ import jdk.internal.vm.Continuation;
+ import jdk.internal.vm.ContinuationScope;
+ import jdk.internal.vm.ThreadContainer;
  import sun.reflect.annotation.AnnotationType;
  import sun.nio.ch.Interruptible;
  
  public interface JavaLangAccess {
  

@@ -408,6 +413,100 @@
      /**
       * Direct access to Shutdown.exit to avoid security manager checks
       * @param statusCode the status code
       */
      void exit(int statusCode);
+     /**
+      * Returns an array of all platform threads.
+      */
+     Thread[] getAllThreads();
+ 
+     /**
+      * Returns the ThreadContainer for a thread, may be null.
+      */
+     ThreadContainer threadContainer(Thread thread);
+ 
+     /**
+      * Starts a thread in the given ThreadContainer.
+      */
+     void start(Thread thread, ThreadContainer container);
+ 
+     /**
+      * Returns the thread container at the head/top of the stack.
+      */
+     ThreadContainer headThreadContainer(Thread thread);
+ 
+     /**
+      * Pushes a thread container to the top of the current thread's stack.
+      * @return the current thread's scope local bindings
+      */
+     Object pushThreadContainer(ThreadContainer container);
+ 
+     /**
+      * Pops a thread container from the current thread's stack.
+      */
+     void popThreadContainer(ThreadContainer container);
+ 
+     /**
+      * Returns a reference to the Thread object for the currently executing
+      * carrier thread.
+      */
+     Thread currentCarrierThread();
+ 
+     /**
+      * Executes the given value returning task on the current carrier thread.
+      */
+     <V> V executeOnCarrierThread(Callable<V> task) throws Exception;
+ 
+     /**
+      * Returns the value of the current carrier thread's copy of a thread-local.
+      */
+     <T> T getCarrierThreadLocal(ThreadLocal<T> local);
+ 
+     /**
+      * Sets the value of the current carrier thread's copy of a thread-local.
+      */
+     <T> void setCarrierThreadLocal(ThreadLocal<T> local, T value);
+ 
+     /**
+      * Returns the current thread's scope locals cache
+      */
+     Object[] scopeLocalCache();
+ 
+     /**
+      * Sets the current thread's scope locals cache
+      */
+     void setScopeLocalCache(Object[] cache);
+ 
+     /**
+      * Returns the innermost mounted continuation
+      */
+      Continuation getContinuation(Thread thread);
+ 
+     /**
+      * Sets the innermost mounted continuation
+      */
+     void setContinuation(Thread thread, Continuation continuation);
+ 
+     /**
+      * Parks the current virtual thread.
+      */
+     void parkVirtualThread();
+ 
+     /**
+      * Parks the current virtual thread for up to the given waiting time.
+      */
+     void parkVirtualThread(long nanos);
+ 
+     /**
+      * Unparks a virtual thread.
+      * @throws RejectedExecutionException if the scheduler cannot accept a task
+      */
+     void unparkVirtualThread(Thread thread);
+ 
+     /**
+      * Creates a new StackWalker
+      */
+     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
+                                        ContinuationScope contScope,
+                                        Continuation continuation);
  }
< prev index next >