|
16 | 16 |
|
17 | 17 | package org.springframework.boot.autoconfigure.web.embedded; |
18 | 18 |
|
19 | | -import java.time.Duration; |
20 | | -import java.util.concurrent.Executor; |
21 | | -import java.util.concurrent.atomic.AtomicReference; |
22 | | - |
23 | | -import org.awaitility.Awaitility; |
24 | | -import org.eclipse.jetty.util.thread.QueuedThreadPool; |
25 | | -import org.hamcrest.Matchers; |
| 19 | +import org.eclipse.jetty.util.thread.VirtualThreadPool; |
26 | 20 | import org.junit.jupiter.api.Test; |
27 | 21 | import org.junit.jupiter.api.condition.EnabledForJreRange; |
28 | 22 | import org.junit.jupiter.api.condition.JRE; |
@@ -51,14 +45,9 @@ void shouldConfigureVirtualThreads() { |
51 | 45 | ConfigurableJettyWebServerFactory factory = mock(ConfigurableJettyWebServerFactory.class); |
52 | 46 | customizer.customize(factory); |
53 | 47 | then(factory).should().setThreadPool(assertArg((threadPool) -> { |
54 | | - assertThat(threadPool).isInstanceOf(QueuedThreadPool.class); |
55 | | - QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool; |
56 | | - Executor executor = queuedThreadPool.getVirtualThreadsExecutor(); |
57 | | - assertThat(executor).isNotNull(); |
58 | | - AtomicReference<String> threadName = new AtomicReference<>(); |
59 | | - executor.execute(() -> threadName.set(Thread.currentThread().getName())); |
60 | | - Awaitility.await().atMost(Duration.ofSeconds(1)).untilAtomic(threadName, Matchers.notNullValue()); |
61 | | - assertThat(threadName.get()).startsWith("jetty-"); |
| 48 | + assertThat(threadPool).isInstanceOf(VirtualThreadPool.class); |
| 49 | + VirtualThreadPool virtualThreadPool = (VirtualThreadPool) threadPool; |
| 50 | + assertThat(virtualThreadPool.getName()).isEqualTo("jetty-"); |
62 | 51 | })); |
63 | 52 | } |
64 | 53 |
|
|
0 commit comments