< prev index next >

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

Print this page
@@ -1245,11 +1245,11 @@
      @MethodSource("oneSecondSleepers")
      void testSleep3(ThrowingRunnable sleeper) throws Exception {
          VThreadRunner.run(() -> {
              long start = millisTime();
              sleeper.run();
-             expectDuration(start, /*min*/900, /*max*/4000);
+             expectDuration(start, /*min*/900, /*max*/20_000);
          });
      }
  
      /**
       * Tasks that sleep for zero or longer duration.

@@ -1335,11 +1335,11 @@
          VThreadRunner.run(() -> {
              LockSupport.unpark(Thread.currentThread());
  
              long start = millisTime();
              Thread.sleep(1000);
-             expectDuration(start, /*min*/900, /*max*/4000);
+             expectDuration(start, /*min*/900, /*max*/20_000);
  
              // check that parking permit was not consumed
              LockSupport.park();
          });
      }

@@ -1352,11 +1352,11 @@
          AtomicReference<Exception> exc = new AtomicReference<>();
          var thread = Thread.ofVirtual().start(() -> {
              try {
                  long start = millisTime();
                  Thread.sleep(1000);
-                 expectDuration(start, /*min*/900, /*max*/4000);
+                 expectDuration(start, /*min*/900, /*max*/20_000);
              } catch (Exception e) {
                  exc.set(e);
              }
  
          });

@@ -1380,11 +1380,11 @@
          VThreadRunner.run(() -> {
              long start = millisTime();
              synchronized (lock) {
                  Thread.sleep(1000);
              }
-             expectDuration(start, /*min*/900, /*max*/4000);
+             expectDuration(start, /*min*/900, /*max*/20_000);
          });
      }
  
      /**
       * Test Thread.sleep when pinned and with interrupt status set.

@@ -1523,32 +1523,16 @@
          } finally {
              t.setContextClassLoader(savedLoader);
          }
      }
  
-     /**
-      * Test Thread.xxxContextClassLoader when thread locals not supported.
-      */
-     @Test
-     void testContextClassLoader5() throws Exception {
-         ClassLoader scl = ClassLoader.getSystemClassLoader();
-         ClassLoader loader = new ClassLoader() { };
-         VThreadRunner.run(VThreadRunner.NO_THREAD_LOCALS, () -> {
-             Thread t = Thread.currentThread();
-             assertTrue(t.getContextClassLoader() == scl);
-             assertThrows(UnsupportedOperationException.class,
-                          () -> t.setContextClassLoader(loader));
-             assertTrue(t.getContextClassLoader() == scl);
-         });
-     }
- 
      /**
       * Test Thread.xxxContextClassLoader when thread does not inherit the
       * initial value of inheritable thread locals.
       */
      @Test
-     void testContextClassLoader6() throws Exception {
+     void testContextClassLoader5() throws Exception {
          VThreadRunner.run(() -> {
              ClassLoader loader = new ClassLoader() { };
              Thread.currentThread().setContextClassLoader(loader);
              int characteristics = VThreadRunner.NO_INHERIT_THREAD_LOCALS;
              VThreadRunner.run(characteristics, () -> {
< prev index next >