public class EventCounterHandler extends Object
IEventCounterFactory
. Create EventCounter
for each registered IEventCounterFactory
and send corresponding events when calling onEvent(IEvent, IMetaInfo, Class)
method.
You can implement your own IEventCounterFactory
and register them with register(IEventCounterFactory)
Or implement EventCounter
and register it with SimpleEventCounterFactory
like this: EventCounterHandler.getInstance().register(new SimpleEventCounterFactory(new SystemOutEventCounter());
SystemOutEventCounter
is just an example of a EventCounter
implementation.
This functionality can be used to create metrics in a SaaS context.
Modifier and Type | Method and Description |
---|---|
static EventCounterHandler |
getInstance() |
boolean |
isRegistered(IEventCounterFactory factory)
Checks whether the specified IEventCounterFactory is registered.
|
void |
onEvent(IEvent event, IMetaInfo metaInfo, Class> caller)
Triggers all registered IEventCounterFactory to produce EventCounter instance and count the event.
|
void |
register(IEventCounterFactory factory)
Register new IEventCounterFactory .
|
boolean |
unregister(IEventCounterFactory factory)
Unregister specified IEventCounterFactory .
|
public static EventCounterHandler getInstance()
public void onEvent(IEvent event, IMetaInfo metaInfo, Class> caller)
IEventCounterFactory
to produce EventCounter
instance and count the event.
public void register(IEventCounterFactory factory)
IEventCounterFactory
. Does nothing if same factory was already registered.
factory
- IEventCounterFactory
to be registered
public boolean isRegistered(IEventCounterFactory factory)
IEventCounterFactory
is registered.
factory
- IEventCounterFactory
to be checked
true
if the specified factory is registered
public boolean unregister(IEventCounterFactory factory)
IEventCounterFactory
. Does nothing if this factory wasn't registered first.
factory
- IEventCounterFactory
to be unregistered
true
if specified factory was registered first
Copyright © 1998–2023 iText Group NV. All rights reserved.