Concurrent Work

Rambling of a coder who craves for knowledge and understanding of the world.

Written by Dongfang Qu

03 Jun 2015

java server graceful shutdown

目的

避免kill -9导致内存中数据丢失,导致业务数据不一致的情况

实践

Runtime.getRuntime().addShutdownHook(new Thread() {
    public void run() {
            // do sth
    }
});

参考

Categories

Tags