public static void exit(int statusCode,@Nullable PreSystemExitHook hook){
  flagStopping();
  try {
    if (hook != null) {
      hook.run();
    }
  }
  finally {
    System.exit(statusCode);
  }
}

public static void exit ( int statusCode , @ Nullable PreSystemExitHook hook ) { flagStopping ( ) ; try { if ( hook != null ) { hook . run ( ) ; } } finally { System . exit ( statusCode ) ; } }
shutdown ' s the vm in such a way that flags that the vm is stopping . this is so that we don ' t run the normal exception handling code when shutting down the application .
