< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page
@@ -81,10 +81,11 @@
  import jdk.internal.vm.ContinuationScope;
  import jdk.internal.vm.StackableScope;
  import jdk.internal.vm.ThreadContainer;
  import jdk.internal.vm.annotation.IntrinsicCandidate;
  import jdk.internal.vm.annotation.Stable;
+ import sun.nio.ch.NativeThread;
  import sun.reflect.annotation.AnnotationType;
  import sun.nio.ch.Interruptible;
  import sun.nio.cs.UTF_8;
  
  /**

@@ -2264,10 +2265,18 @@
  
              public Object scopedValueBindings() {
                  return Thread.scopedValueBindings();
              }
  
+             public NativeThread nativeThread(Thread thread) {
+                 return thread.nativeThread();
+             }
+ 
+             public void setNativeThread(NativeThread nt) {
+                 Thread.currentThread().setNativeThread(nt);
+             }
+ 
              public Continuation getContinuation(Thread thread) {
                  return thread.getContinuation();
              }
  
              public void setContinuation(Thread thread, Continuation continuation) {

@@ -2298,18 +2307,26 @@
  
              public void unparkVirtualThread(Thread thread) {
                  if (thread instanceof BaseVirtualThread vthread) {
                      vthread.unpark();
                  } else {
-                     throw new WrongThreadException();
+                     throw new IllegalArgumentException();
                  }
              }
  
              public Executor virtualThreadDefaultScheduler() {
                  return VirtualThread.defaultScheduler();
              }
  
+             public Executor virtualThreadScheduler(Thread thread) {
+                 if (thread instanceof VirtualThread vthread) {
+                     return vthread.scheduler();
+                 } else {
+                     throw new IllegalArgumentException();
+                 }
+             }
+ 
              public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
                                                        ContinuationScope contScope,
                                                        Continuation continuation) {
                  return StackWalker.newInstance(options, null, contScope, continuation);
              }
< prev index next >