Ensure there is only one shutdown hook
The effect of not doing this is not often noticeable, but you sometimes get a race condition between a context and its parent closing in different threads without it.
This commit is contained in:
@@ -54,7 +54,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class BootstrapApplicationListener implements
|
||||
ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered {
|
||||
|
||||
|
||||
public static final String BOOTSTRAP_PROPERTY_SOURCE_NAME = "bootstrap";
|
||||
|
||||
public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 5;
|
||||
@@ -141,6 +141,7 @@ public class BootstrapApplicationListener implements
|
||||
}
|
||||
}
|
||||
if (!installed) {
|
||||
application.setRegisterShutdownHook(false);
|
||||
application.addInitializers(new AncestorInitializer(context));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user