OpenNMS API 1.2.9

## org.opennms.netmgt.threshd
Class BroadcastEventProcessor

    java.lang.Object
      org.opennms.netmgt.threshd.BroadcastEventProcessor

All Implemented Interfaces:
  EventListener

final class BroadcastEventProcessor
extends java.lang.Object
implements EventListener

Author:
  Mike Davidson , OpenNMS

Field Summary
`private java.util.Map` `m_monitors` The map of service names to service thresholders.
`private Scheduler` `m_scheduler` The scheduler assocated with this receiver
`private java.util.List` `m_thresholdableServices` List of ThresholdableService objects.

Constructor Summary
`(package private)` `BroadcastEventProcessor(java.util.List thresholdableServices)` This constructor is called to initilize the JMS event receiver.

Method Summary
`(package private) void` `close()` Closes the current connections to the Java Message Queue if they are still active.
`protected void` `finalize()` This method may be invoked by the garbage thresholding.
`java.lang.String` `getName()` Return the id of the listener
`private void` `installMessageSelector()` Create message selector to set to the subscription
`private void` `interfaceDeletedHandler(Event event)` This method is responsible for handling interfaceDeleted events.
`private void` `interfaceReparentedHandler(Event event)` This method is responsible for processing 'interfacReparented' events.
`private void` `nodeDeletedHandler(Event event)` This method is responsible for handling nodeDeleted events.
`private void` `nodeGainedServiceHandler(Event event)` Process the event, construct a new ThresholdableService object representing the node/interface combination, and schedule the interface for thresholding.
`void` `onEvent(Event event)` This method is invoked by the JMS topic session when a new event is available for processing.
`private void` `primarySnmpInterfaceChangedHandler(Event event)` Process the 'primarySnmpInterfaceChanged' event.
`private void` `reinitializePrimarySnmpInterfaceHandler(Event event)` Process the event.
`private void` `serviceDeletedHandler(Event event)` This method is responsible for handling serviceDeleted events.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_monitors

    private java.util.Map m_monitors

  The map of service names to service thresholders.

### m_scheduler

    private Scheduler m_scheduler

  The scheduler assocated with this receiver

### m_thresholdableServices

    private java.util.List m_thresholdableServices

  List of ThresholdableService objects.

Constructor Detail

### BroadcastEventProcessor

    BroadcastEventProcessor(java.util.List thresholdableServices)

  This constructor is called to initilize the JMS event receiver. A connection to the message server is opened and this instance is setup as the endpoint for broadcast events. When a new event arrives it is processed and the appropriate action is taken.

Parameters:
  `thresholdableServices` - List of all the ThresholdableService objects scheduled for thresholding.

Method Detail

### installMessageSelector

    private void installMessageSelector()

  Create message selector to set to the subscription

### close

    void close()

  Closes the current connections to the Java Message Queue if they are still active. This call may be invoked more than once safely and may be invoked during object finalization.

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  This method may be invoked by the garbage thresholding. Once invoked it ensures that the `close` method is called at least once during the cycle of this object.

  Throws:
    `java.lang.Throwable`

### getName

    public java.lang.String getName()

  Description copied from interface: `EventListener`
  Return the id of the listener

  Specified by:
    `getName` in interface `EventListener`

### onEvent

    public void onEvent(Event event)

  This method is invoked by the JMS topic session when a new event is available for processing. Currently only text based messages are processed by this callback. Each message is examined for its Universal Event Identifier and the appropriate action is taking based on each UEI.

  Specified by:
    `onEvent` in interface `EventListener`
  Parameters:
    `event` - The event message.

### reinitializePrimarySnmpInterfaceHandler

    private void reinitializePrimarySnmpInterfaceHandler(Event event)

  Process the event. This event is generated when a managed node which supports SNMP gains a new interface. In this situation the ThresholdableService object representing the primary SNMP interface of the node must be reinitialized. The ThresholdableService object associated with the primary SNMP interface for the node will be marked for reinitialization. Reinitializing the ThresholdableService object consists of calling the ServiceThresholder.release() method followed by the ServiceThresholder.initialize() method which will refresh attributes such as the interface key list and number of interfaces (both of which most likely have changed). Reinitialization will take place the next time the ThresholdableService is popped from an interval queue for thresholding. If any errors occur scheduling the service no error is returned.

  Parameters:
    `event` - The event to process.

### nodeGainedServiceHandler

    private void nodeGainedServiceHandler(Event event)

  Process the event, construct a new ThresholdableService object representing the node/interface combination, and schedule the interface for thresholding. If any errors occur scheduling the interface no error is returned.

  Parameters:
    `event` - The event to process.

### primarySnmpInterfaceChangedHandler

    private void primarySnmpInterfaceChangedHandler(Event event)

  Process the 'primarySnmpInterfaceChanged' event. Extract the old and new primary SNMP interface addresses from the event parms. Any ThresholdableService objects located in the collectable services list which match the IP address of the old primary interface and have a service name of "SNMP" are flagged for deletion. This will ensure that the old primary interface is no longer collected against. Finally the new primary SNMP interface is scheduled. The packages are examined and new ThresholdableService objects are created, initialized and scheduled for thresholding.

  Parameters:
    `event` - The event to process.

### interfaceReparentedHandler

    private void interfaceReparentedHandler(Event event)

  This method is responsible for processing 'interfacReparented' events. An 'interfaceReparented' event will have old and new nodeId parms associated with it. All ThresholdableService objects in the service updates map which match the event's interface address and the SNMP service have a reparenting update associated with them. When the scheduler next pops one of these services from an interval queue for thresholding all of the RRDs associated with the old nodeId are moved under the new nodeId and the nodeId of the collectable service is updated to reflect the interface's new parent nodeId.

  Parameters:
    `event` - The event to process.

### nodeDeletedHandler

    private void nodeDeletedHandler(Event event)

  This method is responsible for handling nodeDeleted events.

  Parameters:
    `event` - The event to process.

### interfaceDeletedHandler

    private void interfaceDeletedHandler(Event event)

  This method is responsible for handling interfaceDeleted events.

  Parameters:
    `event` - The event to process.

### serviceDeletedHandler

    private void serviceDeletedHandler(Event event)

  This method is responsible for handling serviceDeleted events.

  Parameters:
    `event` - The event to process.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.