Class LoggingErrorHandler

java.lang.Object
org.agrona.concurrent.errors.LoggingErrorHandler
All Implemented Interfaces:
AutoCloseable, ErrorHandler

public class LoggingErrorHandler extends Object implements ErrorHandler, AutoCloseable
A logging ErrorHandler that records to a DistinctErrorLog and if the log is full then overflows to a PrintStream. If closed then error will be sent to errorOverflow().
  • Field Details

    • isClosed

      private volatile boolean isClosed
    • log

      private final DistinctErrorLog log
    • errorOverflow

      private final PrintStream errorOverflow
  • Constructor Details

  • Method Details

    • close

      public void close()
      Close error handler so that is does not attempt to write to underlying storage which may be unmapped.
      Specified by:
      close in interface AutoCloseable
    • isClosed

      public boolean isClosed()
      Is this LoggingErrorHandler closed.
      Returns:
      true if close() has been called otherwise false.
    • distinctErrorLog

      public DistinctErrorLog distinctErrorLog()
      The wrapped log.
      Returns:
      the wrapped log.
    • errorOverflow

      public PrintStream errorOverflow()
      The wrapped PrintStream for error log overflow when the log is full.
      Returns:
      wrapped PrintStream for error log overflow when the log is full.
    • onError

      public void onError(Throwable throwable)
      Callback to notify of an error that has occurred when processing an operation or event.

      This method is assumed non-throwing, so rethrowing the exception or triggering further exceptions would be a bug.

      Specified by:
      onError in interface ErrorHandler
      Parameters:
      throwable - that occurred while processing an operation or event.