mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-25 02:49:03 +00:00
Only wait for background preinit to complete when it has started
Closes gh-10362
This commit is contained in:
+5
-3
@@ -46,7 +46,8 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
|
||||
public class BackgroundPreinitializer
|
||||
implements ApplicationListener<SpringApplicationEvent> {
|
||||
|
||||
private static final AtomicBoolean preinitializationStarted = new AtomicBoolean(false);
|
||||
private static final AtomicBoolean preinitializationStarted = new AtomicBoolean(
|
||||
false);
|
||||
|
||||
private static final CountDownLatch preinitializationComplete = new CountDownLatch(1);
|
||||
|
||||
@@ -57,8 +58,9 @@ public class BackgroundPreinitializer
|
||||
performPreinitialization();
|
||||
}
|
||||
}
|
||||
if (event instanceof ApplicationReadyEvent
|
||||
|| event instanceof ApplicationFailedEvent) {
|
||||
if ((event instanceof ApplicationReadyEvent
|
||||
|| event instanceof ApplicationFailedEvent)
|
||||
&& preinitializationStarted.get()) {
|
||||
try {
|
||||
preinitializationComplete.await();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user