Package org.agrona.concurrent
Class CountedErrorHandler
java.lang.Object
org.agrona.concurrent.CountedErrorHandler
- All Implemented Interfaces:
AutoCloseable
,ErrorHandler
An
ErrorHandler
which calls AtomicCounter.increment()
before delegating the exception.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicCounter
private final ErrorHandler
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionCountedErrorHandler
(ErrorHandler errorHandler, AtomicCounter errorCounter) Construct a counted error handler with a delegate and counter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close so thatonError(Throwable)
will not delegate and instead print toSystem.err
boolean
isClosed()
Has this instance been closed.void
Callback to notify of an error that has occurred when processing an operation or event.
-
Field Details
-
errorHandler
-
errorCounter
-
isClosed
private volatile boolean isClosed
-
-
Constructor Details
-
CountedErrorHandler
Construct a counted error handler with a delegate and counter.- Parameters:
errorHandler
- to delegate to.errorCounter
- to increment before delegation.
-
-
Method Details
-
close
public void close()Close so thatonError(Throwable)
will not delegate and instead print toSystem.err
- Specified by:
close
in interfaceAutoCloseable
-
isClosed
public boolean isClosed()Has this instance been closed.- Returns:
- true if
close()
has previously been called, otherwise false.
-
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:
onError
in interfaceErrorHandler
- Parameters:
throwable
- that occurred while processing an operation or event.
-