java server graceful shutdown
目的
避免kill -9导致内存中数据丢失,导致业务数据不一致的情况
实践
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
// do sth
}
});
Rambling of a coder who craves for knowledge and understanding of the world.
避免kill -9导致内存中数据丢失,导致业务数据不一致的情况
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
// do sth
}
});