CloseContextAndExit Class — spring-boot Architecture
Architecture documentation for the CloseContextAndExit class in SpringApplicationShutdownHookTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java lines 311–333
static class CloseContextAndExit implements InitializingBean {
private final ConfigurableApplicationContext context;
private final Runnable shutdownHook;
CloseContextAndExit(ConfigurableApplicationContext context, SpringApplicationShutdownHook shutdownHook) {
this.context = context;
this.shutdownHook = shutdownHook;
}
@Override
public void afterPropertiesSet() throws Exception {
this.context.close();
// Simulate System.exit by running the hook on a separate thread and waiting
// for it to complete
Thread thread = new Thread(this.shutdownHook);
thread.start();
thread.join(15000);
assertThat(thread.isAlive()).isFalse();
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free