/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM. * See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalError(Throwable t) { if (isJvmFatalError(t)) { throw (Error) t; } }
/** * Checks whether the given exception indicates a situation that may leave the * JVM in a corrupted state, or an out-of-memory error. * * <p>See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a list of fatal JVM errors. * This method additionally classifies the {@link OutOfMemoryError} as fatal, because it * may occur in any thread (not the one that allocated the majority of the memory) and thus * is often not recoverable by destroying the particular thread that threw the exception. * * @param t The exception to check. * @return True, if the exception is fatal to the JVM or and OutOfMemoryError, false otherwise. */ public static boolean isJvmFatalOrOutOfMemoryError(Throwable t) { return isJvmFatalError(t) || t instanceof OutOfMemoryError; }
/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM * or an out-of-memory error. See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a * definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalErrorOrOOM(Throwable t) { if (isJvmFatalError(t) || t instanceof OutOfMemoryError) { throw (Error) t; } }
public static void suppressExceptions(RunnableWithException action) { try { action.run(); } catch (InterruptedException e) { // restore interrupted state Thread.currentThread().interrupt(); } catch (Throwable t) { if (isJvmFatalError(t)) { rethrow(t); } } }
@Test public void testJvmFatalError() { // not all errors are fatal assertFalse(ExceptionUtils.isJvmFatalError(new Error())); // linkage errors are not fatal assertFalse(ExceptionUtils.isJvmFatalError(new LinkageError())); // some errors are fatal assertTrue(ExceptionUtils.isJvmFatalError(new InternalError())); assertTrue(ExceptionUtils.isJvmFatalError(new UnknownError())); }
/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM. * See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalError(Throwable t) { if (isJvmFatalError(t)) { throw (Error) t; } }
/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM. * See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalError(Throwable t) { if (isJvmFatalError(t)) { throw (Error) t; } }
/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM * or an out-of-memory error. See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a * definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalErrorOrOOM(Throwable t) { if (isJvmFatalError(t) || t instanceof OutOfMemoryError) { throw (Error) t; } }
/** * Rethrows the given {@code Throwable}, if it represents an error that is fatal to the JVM * or an out-of-memory error. See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a * definition of fatal errors. * * @param t The Throwable to check and rethrow. */ public static void rethrowIfFatalErrorOrOOM(Throwable t) { if (isJvmFatalError(t) || t instanceof OutOfMemoryError) { throw (Error) t; } }
/** * Checks whether the given exception indicates a situation that may leave the * JVM in a corrupted state, or an out-of-memory error. * * <p>See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a list of fatal JVM errors. * This method additionally classifies the {@link OutOfMemoryError} as fatal, because it * may occur in any thread (not the one that allocated the majority of the memory) and thus * is often not recoverable by destroying the particular thread that threw the exception. * * @param t The exception to check. * @return True, if the exception is fatal to the JVM or and OutOfMemoryError, false otherwise. */ public static boolean isJvmFatalOrOutOfMemoryError(Throwable t) { return isJvmFatalError(t) || t instanceof OutOfMemoryError; }
/** * Checks whether the given exception indicates a situation that may leave the * JVM in a corrupted state, or an out-of-memory error. * * <p>See {@link ExceptionUtils#isJvmFatalError(Throwable)} for a list of fatal JVM errors. * This method additionally classifies the {@link OutOfMemoryError} as fatal, because it * may occur in any thread (not the one that allocated the majority of the memory) and thus * is often not recoverable by destroying the particular thread that threw the exception. * * @param t The exception to check. * @return True, if the exception is fatal to the JVM or and OutOfMemoryError, false otherwise. */ public static boolean isJvmFatalOrOutOfMemoryError(Throwable t) { return isJvmFatalError(t) || t instanceof OutOfMemoryError; }
private void handleJobManagerRunnerError(Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { fatalErrorHandler.onFatalError(cause); } else { resultFuture.completeExceptionally(cause); } }
private void handleJobManagerRunnerError(Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { fatalErrorHandler.onFatalError(cause); } else { resultFuture.completeExceptionally(cause); } }
private void handleJobManagerRunnerError(Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { fatalErrorHandler.onFatalError(cause); } else { resultFuture.completeExceptionally(cause); } }
private void handleJobMasterError(final Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { log.error("Fatal error occurred on JobManager.", cause); // The fatal error handler implementation should make sure that this call is non-blocking fatalErrorHandler.onFatalError(cause); } else { jobCompletionActions.jobMasterFailed(cause); } }
private void handleJobMasterError(final Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { log.error("Fatal error occurred on JobManager.", cause); // The fatal error handler implementation should make sure that this call is non-blocking fatalErrorHandler.onFatalError(cause); } else { jobCompletionActions.jobMasterFailed(cause); } }
public static void suppressExceptions(RunnableWithException action) { try { action.run(); } catch (InterruptedException e) { // restore interrupted state Thread.currentThread().interrupt(); } catch (Throwable t) { if (isJvmFatalError(t)) { rethrow(t); } } }
private void handleJobMasterError(final Throwable cause) { if (ExceptionUtils.isJvmFatalError(cause)) { log.error("Fatal error occurred on JobManager.", cause); // The fatal error handler implementation should make sure that this call is non-blocking fatalErrorHandler.onFatalError(cause); } else { jobCompletionActions.jobMasterFailed(cause); } }
public static void suppressExceptions(RunnableWithException action) { try { action.run(); } catch (InterruptedException e) { // restore interrupted state Thread.currentThread().interrupt(); } catch (Throwable t) { if (isJvmFatalError(t)) { rethrow(t); } } }
if (ExceptionUtils.isJvmFatalError(t) || (t instanceof OutOfMemoryError && taskManagerConfig.shouldExitJvmOnOutOfMemoryError())) {