예제 #1
0
파일: LlapDaemon.java 프로젝트: Leolh/hive
 @Override
 public void uncaughtException(Thread t, Throwable e) {
   LOG.info("UncaughtExceptionHandler invoked");
   if (ShutdownHookManager.isShutdownInProgress()) {
     LOG.warn("Thread {} threw a Throwable, but we are shutting down, so ignoring this", t, e);
   } else if (e instanceof Error) {
     try {
       LOG.error("Thread {} threw an Error.  Shutting down now...", t, e);
     } catch (Throwable err) {
       // We don't want to not exit because of an issue with logging
     }
     if (e instanceof OutOfMemoryError) {
       // After catching an OOM java says it is undefined behavior, so don't
       // even try to clean up or we can get stuck on shutdown.
       try {
         System.err.println("Halting due to Out Of Memory Error...");
         e.printStackTrace();
       } catch (Throwable err) {
         // Again we done want to exit because of logging issues.
       }
       ExitUtil.halt(-1);
     } else {
       ExitUtil.terminate(-1);
     }
   } else {
     LOG.error("Thread {} threw an Exception. Shutting down now...", t, e);
     ExitUtil.terminate(-1);
   }
 }
예제 #2
0
 /**
  * Forcibly terminates the currently running Java virtual machine.
  *
  * @param status
  * @throws ExitException
  */
 public static void halt(int status) throws HaltException {
   halt(status, "HaltException");
 }
예제 #3
0
 /**
  * Forcibly terminates the currently running Java virtual machine.
  *
  * @param status
  * @param t
  * @throws ExitException
  */
 public static void halt(int status, Throwable t) throws HaltException {
   halt(status, StringUtils.stringifyException(t));
 }