From 612bf95b05cd5288b0e21d57fcb62b1b0d242b3a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 12 Dec 2023 14:50:20 +0000 Subject: [PATCH] Adapt to changes in the locking model for closing an app context See gh-38666 --- .../boot/SpringApplicationShutdownHookTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 5f2d5c1dfc06..bafe2688da89 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 @@ void runWhenContextIsBeingClosedInAnotherThreadWaitsUntilContextIsInactive() thr 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();