public class LoggingErrorHandler extends Object implements ErrorHandler, AutoCloseable
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 and Description |
---|
LoggingErrorHandler(DistinctErrorLog log)
Construct error handler wrapping a
DistinctErrorLog with a default of System.err for the
errorOverflow() . |
LoggingErrorHandler(DistinctErrorLog log,
PrintStream errorOverflow)
Construct error handler wrapping a
DistinctErrorLog and PrintStream for error overflow. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close error handler so that is does not attempt to write to underlying storage which may be unmapped.
|
DistinctErrorLog |
distinctErrorLog()
The wrapped log.
|
PrintStream |
errorOverflow()
The wrapped
PrintStream for error log overflow when the log is full. |
boolean |
isClosed()
Is this
LoggingErrorHandler closed. |
void |
onError(Throwable throwable)
Callback to notify of an error that has occurred when processing an operation or event.
|
public LoggingErrorHandler(DistinctErrorLog log)
DistinctErrorLog
with a default of System.err
for the
errorOverflow()
.log
- to wrap.public LoggingErrorHandler(DistinctErrorLog log, PrintStream errorOverflow)
DistinctErrorLog
and PrintStream
for error overflow.log
- to wrap.errorOverflow
- to be used if the log fills.public void close()
close
in interface AutoCloseable
public boolean isClosed()
LoggingErrorHandler
closed.close()
has been called otherwise false.public DistinctErrorLog distinctErrorLog()
public PrintStream errorOverflow()
PrintStream
for error log overflow when the log is full.PrintStream
for error log overflow when the log is full.public void onError(Throwable throwable)
This method is assumed non-throwing, so rethrowing the exception or triggering further exceptions would be a bug.
onError
in interface ErrorHandler
throwable
- that occurred while processing an operation or event.Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.