public class CountedErrorHandler extends Object implements ErrorHandler, AutoCloseable
ErrorHandler
which calls AtomicCounter.increment()
before delegating the exception.Constructor and Description |
---|
CountedErrorHandler(ErrorHandler errorHandler,
AtomicCounter errorCounter)
Construct a counted error handler with a delegate and counter.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close so that
onError(Throwable) will not delegate and instead print to System.err |
boolean |
isClosed()
Has this instance been closed.
|
void |
onError(Throwable throwable)
Callback to notify of an error that has occurred when processing an operation or event.
|
public CountedErrorHandler(ErrorHandler errorHandler, AtomicCounter errorCounter)
errorHandler
- to delegate to.errorCounter
- to increment before delegation.public void close()
onError(Throwable)
will not delegate and instead print to System.err
close
in interface AutoCloseable
public boolean isClosed()
close()
has previously be called, otherwise false.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.