diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java index 5f2d5c1dfc..bafe2688da 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java @@ -112,8 +112,8 @@ class SpringApplicationShutdownHookTests { closing.await(); Thread shutdownThread = new Thread(shutdownHook); shutdownThread.start(); - // Shutdown thread should become blocked on monitor held by context thread - Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.BLOCKED::equals); + // Shutdown thread should start waiting for context to become inactive + Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.TIMED_WAITING::equals); // Allow context thread to proceed, unblocking shutdown thread proceedWithClose.countDown(); contextThread.join();