I need to change the JVM return code according to the result of my application.
But it is risky to explicitly call System.exit (code), because the application is complex, and it is difficult to determine the end of executable threads.
So, I came up with using hookdown to change the return code before the JVM exits.
But there is a problem that, as I can get the JVM coz source code, it could be an error code, not 0.
java shutdown shutdown-hook
Leslie wu
source share