< prev index next >

test/jdk/java/lang/Thread/virtual/CustomScheduler.java

Print this page
@@ -43,11 +43,10 @@
  import org.junit.jupiter.api.AfterAll;
  import static org.junit.jupiter.api.Assertions.*;
  import static org.junit.jupiter.api.Assumptions.*;
  
  class CustomScheduler {
-     private static final Executor DEFAULT_SCHEDULER = defaultScheduler();
      private static ExecutorService scheduler1;
      private static ExecutorService scheduler2;
  
      @BeforeAll
      static void setup() {

@@ -214,24 +213,10 @@
          } finally {
              Thread.interrupted();
          }
      }
  
-     /**
-      * Returns the default scheduler.
-      */
-     private static Executor defaultScheduler() {
-         try {
-             Field defaultScheduler = Class.forName("java.lang.VirtualThread")
-                     .getDeclaredField("DEFAULT_SCHEDULER");
-             defaultScheduler.setAccessible(true);
-             return (Executor) defaultScheduler.get(null);
-         } catch (Exception e) {
-             throw new RuntimeException(e);
-         }
-     }
- 
      /**
       * Returns the scheduler for the given virtual thread.
       */
      private static Executor scheduler(Thread thread) {
          if (!thread.isVirtual())
< prev index next >