public final class DiagnosticEventService extends java.lang.Object implements DiagnosticEventServiceMBean
DiagnosticEvent
s.Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Removes all active subscribers.
|
void |
disableDiagnostics()
Kill switch for disabling all events immediately, without restarting the node.
|
void |
disableEventPersistence(java.lang.String eventClazz)
Stop storing events.
|
void |
enableEventPersistence(java.lang.String eventClazz)
Start storing events to make them available via
DiagnosticEventServiceMBean.readEvents(String, Long, int) . |
<E extends DiagnosticEvent> |
hasSubscribers(java.lang.Class<E> event)
Indicates if any
Consumer has been registered for the specified class of events. |
<E extends DiagnosticEvent,T extends java.lang.Enum<T>> |
hasSubscribers(java.lang.Class<E> event,
T eventType)
Indicates if any
Consumer has been registered for the specified class of events. |
static DiagnosticEventService |
instance() |
boolean |
isDiagnosticsEnabled() |
<E extends DiagnosticEvent> |
isEnabled(java.lang.Class<E> event)
Indicates if events are enabled for specified event class based on
DatabaseDescriptor.diagnosticEventsEnabled()
and hasSubscribers(Class) . |
<E extends DiagnosticEvent,T extends java.lang.Enum<T>> |
isEnabled(java.lang.Class<E> event,
T eventType)
Indicates if events are enabled for specified event class based on
DatabaseDescriptor.diagnosticEventsEnabled()
and hasSubscribers(Class, Enum) . |
void |
publish(DiagnosticEvent event)
Makes provided event available to all subscribers.
|
java.util.SortedMap<java.lang.Long,java.util.Map<java.lang.String,java.io.Serializable>> |
readEvents(java.lang.String eventClazz,
java.lang.Long lastKey,
int limit)
Retrieved all events of specified type starting with provided key.
|
<E extends DiagnosticEvent> |
subscribe(java.lang.Class<E> event,
java.util.function.Consumer<E> consumer)
Registers event handler for specified class of events.
|
<E extends DiagnosticEvent,T extends java.lang.Enum<T>> |
subscribe(java.lang.Class<E> event,
T eventType,
java.util.function.Consumer<E> consumer)
Registers event handler for specified class of events.
|
void |
subscribeAll(java.util.function.Consumer<DiagnosticEvent> consumer)
Registers event handler for all DiagnosticEvents published from this point.
|
<E extends DiagnosticEvent> |
unsubscribe(java.lang.Class<E> event,
java.util.function.Consumer<E> consumer)
De-registers event handler from receiving any further events.
|
<E extends DiagnosticEvent> |
unsubscribe(java.util.function.Consumer<E> consumer)
De-registers event handler from receiving any further events.
|
public void publish(DiagnosticEvent event)
public <E extends DiagnosticEvent> void subscribe(java.lang.Class<E> event, java.util.function.Consumer<E> consumer)
event
- DiagnosticEvent class implementationconsumer
- Consumer for received eventspublic <E extends DiagnosticEvent,T extends java.lang.Enum<T>> void subscribe(java.lang.Class<E> event, T eventType, java.util.function.Consumer<E> consumer)
event
- DiagnosticEvent class implementationconsumer
- Consumer for received eventspublic void subscribeAll(java.util.function.Consumer<DiagnosticEvent> consumer)
consumer
- Consumer for received eventspublic <E extends DiagnosticEvent> void unsubscribe(java.util.function.Consumer<E> consumer)
consumer
- Consumer registered for receiving eventspublic <E extends DiagnosticEvent> void unsubscribe(@Nullable java.lang.Class<E> event, java.util.function.Consumer<E> consumer)
event
- DiagnosticEvent class to unsubscribe fromconsumer
- Consumer registered for receiving eventspublic <E extends DiagnosticEvent> boolean hasSubscribers(java.lang.Class<E> event)
Consumer
has been registered for the specified class of events.event
- DiagnosticEvent class implementationpublic <E extends DiagnosticEvent,T extends java.lang.Enum<T>> boolean hasSubscribers(java.lang.Class<E> event, T eventType)
Consumer
has been registered for the specified class of events.event
- DiagnosticEvent class implementationeventType
- Subscribed event type matched against DiagnosticEvent.getType()
public <E extends DiagnosticEvent> boolean isEnabled(java.lang.Class<E> event)
DatabaseDescriptor.diagnosticEventsEnabled()
and hasSubscribers(Class)
.event
- DiagnosticEvent class implementationpublic <E extends DiagnosticEvent,T extends java.lang.Enum<T>> boolean isEnabled(java.lang.Class<E> event, T eventType)
DatabaseDescriptor.diagnosticEventsEnabled()
and hasSubscribers(Class, Enum)
.event
- DiagnosticEvent class implementationeventType
- Subscribed event type matched against DiagnosticEvent.getType()
public static DiagnosticEventService instance()
public void cleanup()
public boolean isDiagnosticsEnabled()
isDiagnosticsEnabled
in interface DiagnosticEventServiceMBean
public void disableDiagnostics()
DiagnosticEventServiceMBean
disableDiagnostics
in interface DiagnosticEventServiceMBean
public java.util.SortedMap<java.lang.Long,java.util.Map<java.lang.String,java.io.Serializable>> readEvents(java.lang.String eventClazz, java.lang.Long lastKey, int limit)
DiagnosticEventServiceMBean
readEvents
in interface DiagnosticEventServiceMBean
eventClazz
- fqn of event classlastKey
- ID of first event to retrievelimit
- number of results to returnpublic void enableEventPersistence(java.lang.String eventClazz)
DiagnosticEventServiceMBean
DiagnosticEventServiceMBean.readEvents(String, Long, int)
.enableEventPersistence
in interface DiagnosticEventServiceMBean
public void disableEventPersistence(java.lang.String eventClazz)
DiagnosticEventServiceMBean
disableEventPersistence
in interface DiagnosticEventServiceMBean
Copyright © 2009-2021 The Apache Software Foundation