org.openoss.opennms.spring.qosd
Class OpenNMSEventHandlerThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.openoss.opennms.spring.qosd.OpenNMSEventHandlerThread
All Implemented Interfaces:
java.lang.Runnable

public class OpenNMSEventHandlerThread
extends java.lang.Thread

This class provides a thread to decouple the OpenNMS event handling from updates to the Node list and the Alarm List in the ossDao. If OpenNMS issues multiple events to the QoSD event handler which cause it to want to update the alarm list or update the node list, this Thread latches the event and will request the ossDao to update it's cache and send any new alarms. If further events occur while the ossDao is updating, these will be latched until the process completes. This prevents every new opennms alarm causing a call to the ossDao while it is running which would otherwise back up a queue of requests against it's synchronized methods.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
OpenNMSEventHandlerThread()
           
 
Method Summary
 void init()
          Initialise the Thread.
 void kill()
          Stop execution of the thread.
 void run()
          Run method loops until kill() called.
 void sendAlarmList()
          If called, this method will request that the ossDao Alarm Cache is updated from the OpenNMS database and sent to the QoSD for processing.
 void setossDao(OssDaoOpenNMSImpl _ossDao)
          provides an interface to OpenNMS which provides a unified api
 void updateNodeCache()
          If called, this method will request that the ossDao Node Cache is updated from the OpenNMS database and sent to the QoSD for processing.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenNMSEventHandlerThread

public OpenNMSEventHandlerThread()
Method Detail

setossDao

public void setossDao(OssDaoOpenNMSImpl _ossDao)
provides an interface to OpenNMS which provides a unified api

Parameters:
ossDao - the ossDao to set

run

public void run()
         throws java.lang.IllegalStateException
Run method loops until kill() called. It wakes up if sendAlarmList() is called and updates the alarmlist It wakes up if updateNodeCache() is called and updates the node list init() must be called before the run() method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
Throws:
java.lang.IllegalStateException

init

public void init()
Initialise the Thread. Must be called before a call to run.


kill

public void kill()
Stop execution of the thread. Will complete any current update before exiting


sendAlarmList

public void sendAlarmList()
If called, this method will request that the ossDao Alarm Cache is updated from the OpenNMS database and sent to the QoSD for processing. Note that multiple calls while the update process is running will be latched ( i.e. not queued) and result another update when the previous one completes


updateNodeCache

public void updateNodeCache()
If called, this method will request that the ossDao Node Cache is updated from the OpenNMS database and sent to the QoSD for processing. Note that multiple calls while the update process is running will be latched ( i.e. not queued) and result in only one update when the previous one completes



Copyright ? 2006-2008. All Rights Reserved.