public class MetricEventsSubject<E extends MetricsEvent<?>> extends java.lang.Object implements MetricEventsPublisher<E>, MetricEventsListener<E>
MetricEventsListener and MetricEventsPublisher.
Any invocation of MetricEventsListener methods invoke on this will in turn call
all the underlying listeners. If any of the listener throws a fatal exception (as determined by
Exceptions.throwIfFatal(Throwable)) no other listener is invoked, otherwise all the listeners
are invoked. In case any of the listener threw a non-fatal exception, eventually, the invoked method on this subject
will throw a ListenerInvocationException with all the non-fatal exceptions thrown by all listeners for this
call.NO_DURATION, NO_ERROR, NO_TIME_UNIT, NO_VALUE| Constructor and Description |
|---|
MetricEventsSubject() |
| Modifier and Type | Method and Description |
|---|---|
protected ListenerInvocationException |
handleListenerError(ListenerInvocationException exception,
io.reactivex.netty.metrics.MetricEventsSubject.SafeListener<? extends E> listener,
java.lang.Throwable e) |
void |
onCompleted()
Marks the end of all event callbacks.
|
void |
onEvent(E event) |
void |
onEvent(E event,
long durationInMillis) |
void |
onEvent(E event,
long durationInMillis,
java.lang.Object value) |
void |
onEvent(E event,
long durationInMillis,
java.lang.Throwable throwable) |
void |
onEvent(E event,
long durationInMillis,
java.lang.Throwable throwable,
java.lang.Object value) |
void |
onEvent(E event,
long duration,
java.util.concurrent.TimeUnit timeUnit) |
void |
onEvent(E event,
long duration,
java.util.concurrent.TimeUnit timeUnit,
java.lang.Object value) |
void |
onEvent(E event,
long duration,
java.util.concurrent.TimeUnit timeUnit,
java.lang.Throwable throwable) |
void |
onEvent(E event,
long duration,
java.util.concurrent.TimeUnit timeUnit,
java.lang.Throwable throwable,
java.lang.Object value)
Event callback for any
MetricsEvent. |
void |
onEvent(E event,
java.lang.Object value) |
void |
onEvent(E event,
java.lang.Throwable throwable) |
void |
onSubscribe()
A callback when this listener is subscribed to a
MetricEventsPublisher. |
rx.Subscription |
subscribe(MetricEventsListener<? extends E> listener) |
protected void |
throwIfErrorOccured(ListenerInvocationException exception) |
public void onEvent(E event, long duration, java.util.concurrent.TimeUnit timeUnit, java.lang.Throwable throwable, java.lang.Object value)
MetricEventsListenerMetricsEvent. The parameters passed are all the contextual information possible for
any event. There presence or absence will depend on the type of event.onEvent in interface MetricEventsListener<E extends MetricsEvent<?>>event - Event for which this callback has been invoked. This will never be nullduration - If the passed event is MetricsEvent.isTimed() then the actual duration, else
MetricEventsListener.NO_DURATIONtimeUnit - The time unit for the duration, if exists, else MetricEventsListener.NO_TIME_UNITthrowable - If the passed event is MetricsEvent.isError() then the cause of the error, else
MetricEventsListener.NO_ERRORvalue - If the passed event requires custom object to be passed, then that object, else MetricEventsListener.NO_VALUEpublic void onEvent(E event, long durationInMillis, java.lang.Throwable throwable, java.lang.Object value)
public void onEvent(E event)
public void onEvent(E event, java.lang.Throwable throwable)
public void onEvent(E event, long duration, java.util.concurrent.TimeUnit timeUnit)
public void onEvent(E event, long duration, java.util.concurrent.TimeUnit timeUnit, java.lang.Throwable throwable)
public void onEvent(E event, long duration, java.util.concurrent.TimeUnit timeUnit, java.lang.Object value)
public void onEvent(E event, long durationInMillis)
public void onEvent(E event, long durationInMillis, java.lang.Throwable throwable)
public void onEvent(E event, long durationInMillis, java.lang.Object value)
public void onEvent(E event, java.lang.Object value)
public void onCompleted()
MetricEventsListeneronCompleted in interface MetricEventsListener<E extends MetricsEvent<?>>public void onSubscribe()
MetricEventsListenerMetricEventsPublisher.onSubscribe in interface MetricEventsListener<E extends MetricsEvent<?>>public rx.Subscription subscribe(MetricEventsListener<? extends E> listener)
subscribe in interface MetricEventsPublisher<E extends MetricsEvent<?>>protected ListenerInvocationException handleListenerError(ListenerInvocationException exception, io.reactivex.netty.metrics.MetricEventsSubject.SafeListener<? extends E> listener, java.lang.Throwable e)
protected void throwIfErrorOccured(ListenerInvocationException exception)