public void run () { Runtime.getRuntime().halt(0); // Because fuck you, deadlock causing Swing shutdown hooks. } };
public void run () { Runtime.getRuntime().halt(0); // Because fuck you, deadlock causing Swing shutdown hooks. } };
public void run () { Runtime.getRuntime().halt(0); // Because fuck you, deadlock causing Swing shutdown hooks. } };
public void run () { Runtime.getRuntime().halt(0); // Because fuck you, deadlock causing Swing shutdown hooks. } };
@Override public void execute(int statusCode, String message) { Runtime.getRuntime().halt(statusCode); } };
public static void haltProcess(int val) { Runtime.getRuntime().halt(val); }
public static void haltProcess(int val) { Runtime.getRuntime().halt(val); }
private void handleServerException(Exception ex) { LOG.error("ThriftServer is being stopped due to: " + ex, ex); if (server != null) { server.stop(); } Runtime.getRuntime().halt(1); //shutdown server process since we could not handle Thrift requests any more }
public static void handleUncaughtException(Throwable t) { if (t != null && t instanceof Error) { if (t instanceof OutOfMemoryError) { try { System.err.println("Halting due to Out Of Memory Error..." + Thread.currentThread().getName()); } catch (Throwable err) { // Again we don't want to exit because of logging issues. } Runtime.getRuntime().halt(-1); } else { // Running in daemon mode, we would pass Error to calling thread. throw (Error) t; } } }
public static void halt_process(int val, String msg) { LOG.info("Halting process: " + msg); try { Thread.sleep(1000); } catch (InterruptedException e) { LOG.error("halt_process", e); } Runtime.getRuntime().halt(val); }
public static void handleUncaughtException(Throwable t, Set<Class> allowedExceptions) { if (t != null) { if (t instanceof OutOfMemoryError) { try { System.err.println("Halting due to Out Of Memory Error..." + Thread.currentThread().getName()); } catch (Throwable err) { //Again we don't want to exit because of logging issues. } Runtime.getRuntime().halt(-1); } } if (allowedExceptions.contains(t.getClass())) { LOG.info("Swallowing {} {}", t.getClass(), t); return; } //Running in daemon mode, we would pass Error to calling thread. throw new Error(t); }
/** * Handler for out of memory events -no attempt is made here * to cleanly shutdown or support halt blocking; a robust * printing of the event to stderr is all that can be done. * @param oome out of memory event */ public static void haltOnOutOfMemory(OutOfMemoryError oome) { //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..."); } catch (Throwable err) { //Again we done want to exit because of logging issues. } Runtime.getRuntime().halt(-1); } }
@Override public void run() { try { if (!latch.await(timeout, TimeUnit.MILLISECONDS)) { U.error(log, "Stopping local node timeout, JVM will be halted."); Runtime.getRuntime().halt(Ignition.KILL_EXIT_CODE); } } catch (InterruptedException e) { // No-op. } } },
@Override public void handle(Signal signal) { if (exitSignalTriggered.get()) { System.err.println("Exiting with extreme prejudice due to " + signal); // Really exit Runtime.getRuntime().halt(0); } else { System.err.println("Attempting gentle exit on " + signal); exitSignalTriggered.set(true); existingExitHandler.get().handle(signal); } } };
public static boolean exitIfOOME(final Throwable e ){ boolean stop = false; try { if (e instanceof OutOfMemoryError || (e.getCause() != null && e.getCause() instanceof OutOfMemoryError) || (e.getMessage() != null && e.getMessage().contains( "java.lang.OutOfMemoryError"))) { stop = true; LOG.error(HBaseMarkers.FATAL, "Run out of memory; " + RSRpcServices.class.getSimpleName() + " will abort itself immediately", e); } } finally { if (stop) { Runtime.getRuntime().halt(1); } } return stop; }
/** * Adds the user supplied function as a shutdown hook for cleanup. Also adds a function that sleeps for numSecs and then halts the * runtime to avoid any zombie process in case cleanup function hangs. */ public static void addShutdownHookWithDelayedForceKill(Runnable func, int numSecs) { final Thread sleepKill = new Thread(() -> { try { LOG.info("Halting after {} seconds", numSecs); Time.sleepSecs(numSecs); LOG.warn("Forcing Halt... {}", Utils.threadDump()); Runtime.getRuntime().halt(20); } catch (InterruptedException ie) { //Ignored/expected... } catch (Exception e) { LOG.warn("Exception in the ShutDownHook", e); } }); sleepKill.setDaemon(true); Thread wrappedFunc = new Thread(() -> { func.run(); sleepKill.interrupt(); }); Runtime.getRuntime().addShutdownHook(wrappedFunc); Runtime.getRuntime().addShutdownHook(sleepKill); }
@Override public void run() { if (state(name) == IgniteState.STARTED) { U.error(null, "Unable to gracefully stop node within timeout " + timeoutMs + " milliseconds. Killing node..."); // We are not able to kill only one grid so whole JVM will be stopped. Runtime.getRuntime().halt(Ignition.KILL_EXIT_CODE); } } }, timeoutMs, TimeUnit.MILLISECONDS);
@Override public void flatMap(Long key, Collector<String> collector) throws IOException { if (allocationFailureMessage != null) { // Report the failure downstream, so that we can get the message from the output. collector.collect(allocationFailureMessage); allocationFailureMessage = null; } if (failTask) { // we fail the task, either by killing the JVM hard, or by throwing a user code exception. if (killTaskOnFailure) { Runtime.getRuntime().halt(-1); } else { throw new RuntimeException("Artificial user code exception."); } } // sanity check if (null != valueState.value()) { throw new IllegalStateException("This should never happen, keys are generated monotonously."); } // store artificial data to blow up the state valueState.update(RandomStringUtils.random(valueSize, true, true)); }
public void serve() { try { // locate our thrift transport plugin ITransportPlugin transportPlugin = AuthUtils.GetTransportPlugin(_type, _storm_conf, _login_conf); // server _server = transportPlugin.getServer(_processor); // start accepting requests _server.serve(); } catch (Exception ex) { LOG.error("ThriftServer is being stopped due to: " + ex, ex); if (_server != null) _server.stop(); Runtime.getRuntime().halt(1); // shutdown server process since we could not handle Thrift requests any more } } }
/** {@inheritDoc} */ @Override public void clear() throws IOException { super.clear(); System.err.println("Truncated file: " + file.getAbsolutePath()); truncations.incrementAndGet(); Integer checkpointedPart = null; try { Field field = GridDhtLocalPartition.class.getDeclaredField("partWhereTestCheckpointEnforced"); field.setAccessible(true); checkpointedPart = (Integer) field.get(null); } catch (Exception e) { e.printStackTrace(); } // Wait while more than one file have truncated and checkpoint on partition eviction has done. if (truncations.get() > 1 && checkpointedPart != null) { System.err.println("JVM is going to be crushed for test reasons..."); Runtime.getRuntime().halt(0); } } }