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 java.lang.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 class
EventIpcManagerDefaultImpl.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 void
addEventListener(EventListener listener)
Registers an event listener that is interested in all eventsvoid
addEventListener(EventListener listener, java.lang.String uei)
Register an event listener interested in the passed UEI.void
addEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Registers an event listener interested in the UEIs in the passed listvoid
afterPropertiesSet()
afterPropertiesSetvoid
broadcastNow(Event event, boolean synchronous)
Called by eventd to send an event to all interested listeners.EventHandler
getEventHandler()
getEventHandlerint
getHandlerPoolSize()
getHandlerPoolSizeint
getHandlerQueueLength()
getHandlerQueueLengthboolean
hasEventListener(java.lang.String uei)
Checks if there is at least one listener for the given uei.void
removeEventListener(EventListener listener)
Removes a registered event listenervoid
removeEventListener(EventListener listener, java.lang.String uei)
Removes a registered event listener.void
removeEventListener(EventListener listener, java.util.Collection<java.lang.String> ueis)
Removes a registered event listener - the UEI list indicates the list of events the listener is no more interested invoid
send(Event event)
This method is called to send the event outvoid
send(Log eventLog)
sendvoid
sendNow(Event event)
Asynchronously sends an event to eventd.void
sendNow(Log eventLog)
Called by a service to send a set of events to other listeners.void
sendNowSync(Event event)
Synchronously sends an event to eventd.void
sendNowSync(Log eventLog)
Synchronously sends a set of events to eventd.void
setEventHandler(EventHandler eventHandler)
setEventHandlervoid
setHandlerPoolSize(int handlerPoolSize)
setHandlerPoolSizevoid
setHandlerQueueLength(int size)
setHandlerQueueLength
-
-
-
Method Detail
-
send
public void send(Event event) throws EventProxyException
This method is called to send the event out- Specified by:
send
in 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:
send
in interfaceEventProxy
- Parameters:
eventLog
- aLog
object.- 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:
sendNow
in interfaceEventForwarder
- Parameters:
event
- aEvent
object.
-
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:
sendNow
in interfaceEventForwarder
- Parameters:
eventLog
- aLog
object.
-
sendNowSync
public void sendNowSync(Event event)
Description copied from interface:EventForwarder
Synchronously sends an event to eventd.- Specified by:
sendNowSync
in interfaceEventForwarder
- Parameters:
event
- aEvent
object.
-
sendNowSync
public void sendNowSync(Log eventLog)
Description copied from interface:EventForwarder
Synchronously sends a set of events to eventd.- Specified by:
sendNowSync
in interfaceEventForwarder
- Parameters:
eventLog
- aLog
object.
-
broadcastNow
public void broadcastNow(Event event, boolean synchronous)
Description copied from interface:EventIpcBroadcaster
Called by eventd to send an event to all interested listeners.- Specified by:
broadcastNow
in interfaceEventIpcBroadcaster
- Parameters:
event
- aEvent
object.synchronous
- Whether this call should wait for allEventListener
calls 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:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.
-
addEventListener
public void addEventListener(EventListener listener, java.util.Collection<java.lang.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:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.ueis
- aCollection
object.
-
addEventListener
public void addEventListener(EventListener listener, java.lang.String uei)
Register an event listener interested in the passed UEI.- Specified by:
addEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.uei
- aString
object.
-
removeEventListener
public void removeEventListener(EventListener listener, java.util.Collection<java.lang.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:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.ueis
- aCollection
object.
-
removeEventListener
public void removeEventListener(EventListener listener, java.lang.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:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.uei
- aString
object.
-
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:
removeEventListener
in interfaceEventSubscriptionService
- Parameters:
listener
- aEventListener
object.
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getEventHandler
public EventHandler getEventHandler()
getEventHandler
- Returns:
- a
EventHandler
object.
-
setEventHandler
public void setEventHandler(EventHandler eventHandler)
setEventHandler
- Parameters:
eventHandler
- aEventHandler
object.
-
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(java.lang.String uei)
Description copied from interface:EventSubscriptionService
Checks if there is at least one listener for the given uei.- Specified by:
hasEventListener
in interfaceEventSubscriptionService
- Parameters:
uei
- the uie to check for- Returns:
true
iff there is at least one listener
-
-