public class GracefulShutdownHook extends Object implements Runnable
run() will be executed.
1. The Actuator Healthcheck will be down if actuator is used otherwise your implemented ProbeController
Rest Service /ready is set to false so it will return 404
2. Thread.wait with the configured wait time will cause the shutdownprocess to wait.
This is necessary to give Openshift time to execute the readyness Probe. Once the readynessprobe is false,
Openshift Removes the Pod for future Requests
3. All Open Requests will be finished.
4. After waiting the configured estaGracefulShutdownWaitSeconds, the applicationContext will be closed.
For the ShutdownHook to work, you need to
provide a ProbeController for the readyness and liveness probe which must implement
the interface IProbeController
| Modifier and Type | Field and Description |
|---|---|
protected static String |
GRACEFUL_SHUTDOWN_WAIT_SECONDS |
| Constructor and Description |
|---|
GracefulShutdownHook(org.springframework.context.ConfigurableApplicationContext applicationContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
run()
Will first set the readyness or healthchecks to false.
|
protected static final String GRACEFUL_SHUTDOWN_WAIT_SECONDS
public GracefulShutdownHook(org.springframework.context.ConfigurableApplicationContext applicationContext)
public void run()
IProbeController
After the Application will wait for the configured timeout till it finally shutdown the spring context.Copyright © 2019. All rights reserved.