@@ -0,0 +1,940 @@
+package com.yuzhouwan.hacker.jvm.hook;%0A%0A/**%0A * Copyright @ 2019 yuzhouwan.com%0A * All right reserved.%0A * Function%EF%BC%9AShutdownHook Example%0A *%0A * @author Benedict Jin%0A * @since 2019/8/7%0A */%0Apublic class ShutdownHookExample %7B%0A%0A    /**%0A     * registering%0A     * registered%0A     * exit%0A     * shutdown2...%0A     * shutdown3...%0A     * shutdown1...%0A     *%0A     * @see %3Ca href=%22https://yuzhouwan.com/posts/190413/#Shutdown-Hook%22%3EShutdown Hook%3C/a%3E%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(%22registering%22);%0A        Runtime.getRuntime().addShutdownHook(new Thread(() -%3E System.out.println(%22shutdown1...%22)));%0A        Runtime.getRuntime().addShutdownHook(new Thread(() -%3E System.out.println(%22shutdown2...%22)));%0A        Runtime.getRuntime().addShutdownHook(new Thread(() -%3E System.out.println(%22shutdown3...%22)));%0A        System.out.println(%22registered%22);%0A        System.out.println(%22exit%22);%0A        System.exit(0);%0A    %7D%0A%7D%0A

Add ShutdownHook Example