Class FatalErrorHandlers

java.lang.Object
io.activej.common.exception.FatalErrorHandlers

public class FatalErrorHandlers extends Object
Utility methods that allow to handle fatal errors using thread-specific handlers
  • Constructor Details

    • FatalErrorHandlers

      public FatalErrorHandlers()
  • Method Details

    • ignore

      public static FatalErrorHandler ignore()
      A fatal error handler that simply ignores all received errors
    • halt

      public static FatalErrorHandler halt()
      A fatal error handler that terminates JVM on any Throwable
    • haltOnError

      public static FatalErrorHandler haltOnError()
      A fatal error handler that terminates JVM on any Error
    • haltOnVirtualMachineError

      public static FatalErrorHandler haltOnVirtualMachineError()
      A fatal error handler that terminates JVM on any VirtualMachineError
    • haltOnOutOfMemoryError

      public static FatalErrorHandler haltOnOutOfMemoryError()
      A fatal error handler that terminates JVM on any OutOfMemoryError
    • haltOn

      public static FatalErrorHandler haltOn(Predicate<Throwable> predicate)
      A fatal error handler that terminates JVM on any error that matches a given predicate
      Parameters:
      predicate - a predicate that tests a received error
    • rethrow

      public static FatalErrorHandler rethrow()
      A fatal error handler that rethrows any error it receives
    • rethrowOn

      public static FatalErrorHandler rethrowOn(Predicate<Throwable> predicate)
      A fatal error handler that rethrows any error that matches a given predicate
      Parameters:
      predicate - a predicate that tests a received error
    • logging

      public static FatalErrorHandler logging()
      A fatal error handler that logs all errors to an internal Logger
    • loggingTo

      public static FatalErrorHandler loggingTo(org.slf4j.Logger logger)
      A fatal error handler that logs all errors to a given Logger
      Parameters:
      logger - a logger to log all the received errors
    • loggingToSystemOut

      public static FatalErrorHandler loggingToSystemOut()
      A fatal error handler that logs all errors to a standard output stream
      See Also:
    • loggingToSystemErr

      public static FatalErrorHandler loggingToSystemErr()
      A fatal error handler that logs all errors to a standard error output stream
      See Also:
    • loggingTo

      public static FatalErrorHandler loggingTo(PrintStream stream)
      A fatal error handler that logs all errors to a given PrintStream
      Parameters:
      stream - a print stream to log all the received errors