Package org.opennms.netmgt.eventd
Class EventIpcManagerDefaultImpl
- java.lang.Object
-
- org.opennms.netmgt.eventd.EventIpcManagerDefaultImpl
-
- All Implemented Interfaces:
EventForwarder,EventIpcBroadcaster,EventIpcManager,EventProxy,EventSubscriptionService,org.springframework.beans.factory.InitializingBean
public class EventIpcManagerDefaultImpl extends Object implements EventIpcManager, EventIpcBroadcaster, org.springframework.beans.factory.InitializingBean
An implementation of the EventIpcManager interface that can be used to communicate between services in the same JVM- Author:
- Sowmya Nataraj , OpenNMS.org
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEventIpcManagerDefaultImpl.DiscardTrapsAndSyslogEvents
-
Constructor Summary
Constructors Constructor Description EventIpcManagerDefaultImpl(com.codahale.metrics.MetricRegistry registry)Constructor for EventIpcManagerDefaultImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(EventListener listener)Registers an event listener that is interested in all eventsvoidaddEventListener(EventListener listener, String uei)Register an event listener interested in the passed UEI.voidaddEventListener(EventListener listener, Collection<String> ueis)Registers an event listener interested in the UEIs in the passed listvoidafterPropertiesSet()afterPropertiesSetvoidbroadcastNow(Event event, boolean synchronous)Called by eventd to send an event to all interested listeners.EventHandlergetEventHandler()getEventHandlerintgetHandlerPoolSize()getHandlerPoolSizeintgetHandlerQueueLength()getHandlerQueueLengthbooleanhasEventListener(String uei)Checks if there is at least one listener for the given uei.voidremoveEventListener(EventListener listener)Removes a registered event listenervoidremoveEventListener(EventListener listener, String uei)Removes a registered event listener.voidremoveEventListener(EventListener listener, Collection<String> ueis)Removes a registered event listener - the UEI list indicates the list of events the listener is no more interested invoidsend(Event event)This method is called to send the event outvoidsend(Log eventLog)sendvoidsendNow(Event event)Asynchronously sends an event to eventd.voidsendNow(Log eventLog)Called by a service to send a set of events to other listeners.voidsendNowSync(Event event)Synchronously sends an event to eventd.voidsendNowSync(Log eventLog)Synchronously sends a set of events to eventd.voidsetEventHandler(EventHandler eventHandler)setEventHandlervoidsetHandlerPoolSize(int handlerPoolSize)setHandlerPoolSizevoidsetHandlerQueueLength(int size)setHandlerQueueLength
-
-
-
Method Detail
-
send
public void send(Event event) throws EventProxyException
This method is called to send the event out- Specified by:
sendin interfaceEventProxy- Parameters:
event- the event to be sent out- Throws:
EventProxyException- thrown if the send fails for any reason
-
send
public void send(Log eventLog) throws EventProxyException
send
- Specified by:
sendin interfaceEventProxy- Parameters:
eventLog- aLogobject.- Throws:
EventProxyException- if any.
-
sendNow
public void sendNow(Event event)
Asynchronously sends an event to eventd. Called by a service to send an event to other listeners.- Specified by:
sendNowin interfaceEventForwarder- Parameters:
event- aEventobject.
-
sendNow
public void sendNow(Log eventLog)
Called by a service to send a set of events to other listeners. Creates a new event handler for the event log and queues it to the event handler thread pool.- Specified by:
sendNowin interfaceEventForwarder- Parameters:
eventLog- aLogobject.
-
sendNowSync
public void sendNowSync(Event event)
Description copied from interface:EventForwarderSynchronously sends an event to eventd.- Specified by:
sendNowSyncin interfaceEventForwarder- Parameters:
event- aEventobject.
-
sendNowSync
public void sendNowSync(Log eventLog)
Description copied from interface:EventForwarderSynchronously sends a set of events to eventd.- Specified by:
sendNowSyncin interfaceEventForwarder- Parameters:
eventLog- aLogobject.
-
broadcastNow
public void broadcastNow(Event event, boolean synchronous)
Description copied from interface:EventIpcBroadcasterCalled by eventd to send an event to all interested listeners.- Specified by:
broadcastNowin interfaceEventIpcBroadcaster- Parameters:
event- aEventobject.synchronous- Whether this call should wait for allEventListenercalls to finish before returning.
-
addEventListener
public void addEventListener(EventListener listener)
Registers an event listener that is interested in all events Register an event listener that is interested in all events. Removes this listener from any UEI-specific matches.- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.
-
addEventListener
public void addEventListener(EventListener listener, Collection<String> ueis)
Registers an event listener interested in the UEIs in the passed list Register an event listener interested in the UEIs in the passed list.- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.ueis- aCollectionobject.
-
addEventListener
public void addEventListener(EventListener listener, String uei)
Register an event listener interested in the passed UEI.- Specified by:
addEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.uei- aStringobject.
-
removeEventListener
public void removeEventListener(EventListener listener, Collection<String> ueis)
Removes a registered event listener - the UEI list indicates the list of events the listener is no more interested in Removes a registered event listener. The UEI list indicates the list of events the listener is no more interested in. Note: The listener thread for this listener is not stopped until the 'removeEventListener(EventListener listener)' method is called.- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.ueis- aCollectionobject.
-
removeEventListener
public void removeEventListener(EventListener listener, String uei)
Removes a registered event listener. The UEI indicates one the listener is no more interested in. Note: The listener thread for this listener is not stopped until the 'removeEventListener(EventListener listener)' method is called.- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.uei- aStringobject.
-
removeEventListener
public void removeEventListener(EventListener listener)
Removes a registered event listener Removes a registered event listener. Note: Only this method stops the listener thread for the listener passed.- Specified by:
removeEventListenerin interfaceEventSubscriptionService- Parameters:
listener- aEventListenerobject.
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getEventHandler
public EventHandler getEventHandler()
getEventHandler
- Returns:
- a
EventHandlerobject.
-
setEventHandler
public void setEventHandler(EventHandler eventHandler)
setEventHandler
- Parameters:
eventHandler- aEventHandlerobject.
-
getHandlerPoolSize
public int getHandlerPoolSize()
getHandlerPoolSize
- Returns:
- a int.
-
setHandlerPoolSize
public void setHandlerPoolSize(int handlerPoolSize)
setHandlerPoolSize
- Parameters:
handlerPoolSize- a int.
-
getHandlerQueueLength
public int getHandlerQueueLength()
getHandlerQueueLength
- Returns:
- a int.
-
setHandlerQueueLength
public void setHandlerQueueLength(int size)
setHandlerQueueLength
- Parameters:
size- a int.
-
hasEventListener
public boolean hasEventListener(String uei)
Description copied from interface:EventSubscriptionServiceChecks if there is at least one listener for the given uei.- Specified by:
hasEventListenerin interfaceEventSubscriptionService- Parameters:
uei- the uie to check for- Returns:
trueiff there is at least one listener
-
-