I need to modify JVM return code according to my application result.
But it is risky to explicitly call System.exit(code) coz the application is complicated and it is hard to identify the end of running threads.
So I come up with using shutdown hook to modify the return code before JVM exit.
But there is a problem that how can I get the original return code of JVM coz it may be an error code not 0.