Package org.agrona.concurrent.errors
Class LoggingErrorHandler
java.lang.Object
org.agrona.concurrent.errors.LoggingErrorHandler
- All Implemented Interfaces:
AutoCloseable,ErrorHandler
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().-
Constructor Summary
ConstructorsConstructorDescriptionConstruct error handler wrapping aDistinctErrorLogwith a default ofSystem.errfor theerrorOverflow().LoggingErrorHandler(DistinctErrorLog log, PrintStream errorOverflow) Construct error handler wrapping aDistinctErrorLogandPrintStreamfor error overflow. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close error handler so that is does not attempt to write to underlying storage which may be unmapped.The wrapped log.The wrappedPrintStreamfor error log overflow when the log is full.booleanisClosed()Is thisLoggingErrorHandlerclosed.voidCallback to notify of an error that has occurred when processing an operation or event.
-
Constructor Details
-
LoggingErrorHandler
Construct error handler wrapping aDistinctErrorLogwith a default ofSystem.errfor theerrorOverflow().- Parameters:
log- to wrap.
-
LoggingErrorHandler
Construct error handler wrapping aDistinctErrorLogandPrintStreamfor error overflow.- Parameters:
log- to wrap.errorOverflow- to be used if the log fills.
-
-
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:
closein interfaceAutoCloseable
-
isClosed
public boolean isClosed()Is thisLoggingErrorHandlerclosed.- Returns:
- true if
close()has been called otherwise false.
-
distinctErrorLog
The wrapped log.- Returns:
- the wrapped log.
-
errorOverflow
The wrappedPrintStreamfor error log overflow when the log is full.- Returns:
- wrapped
PrintStreamfor error log overflow when the log is full.
-
onError
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:
onErrorin interfaceErrorHandler- Parameters:
throwable- that occurred while processing an operation or event.
-