OpenNMS API 1.2.3

org.opennms.netmgt.rtc
Class RTCManager

java.lang.Object
  extended byorg.opennms.netmgt.rtc.RTCManager
All Implemented Interfaces:
Fiber, PausableFiber

public final class RTCManager
extends java.lang.Object
implements PausableFiber

Maintains calculations for categories.

The RTCManager maintains data required so as to calculate availability for the different categories configured in categories.xml

The RTC initializes its data from the database when it comes up. It then subscribes to the Events subsystem to receive events of interest to keep the data up-to-date

Availability data is sent out to listeners who indicate that they are listening by sending an RTC 'subscribe' event. The subscribe event has an URL and user/passwd info. so RTC can post data to the URL

The RTC has two timers(a low threshold and a high threshold) and a counter that can run upto a configurable max number of events - these are used to determine when availability information is to be sent out when event streams are coming in at normal rates. When no events are received, a timer configured with a user configured time(defaulting to one minute) decides the interval at which data is sent

Author:
Sowmya Kumaraswamy , OpenNMS.org
See Also:
RTCConstants, DataSender, DataManager

Nested Class Summary
private  class RTCManager.RTCTimerTask
          The timer scheduled task that runs and informs the RTCManager when the timer goes off
 
Field Summary
private static java.lang.String HIGHT_TASK
          The id for the high threshold timer task
private static java.lang.String LOG4J_CATEGORY
          The log4j category used to log debug messsages and statements.
private static java.lang.String LOWT_TASK
          The id for the low threshold timer task
private  int m_counter
          The counter keeping track of the number of messages
private static DataManager m_dataMgr
          manager of the data maintained by the RTC
private  DataSender m_dataSender
          The DataSender
private  BroadcastEventProcessor m_eventReceiver
          The events receiver
private  long m_highThresholdInterval
          The high threshold refresh interval.
private  java.util.TimerTask m_highTtask
          The high threshold timer task
private  long m_lowThresholdInterval
          The low threshold refresh interval.
private  java.util.TimerTask m_lowTtask
          The low threshold timer task
private static long m_rollingWindow
          The configurable rolling window read from the properties file
private static RTCManager m_singleton
          Singleton instance of this class
private  int m_status
          The current status of this fiber
private  java.util.Timer m_timer
          The RTC timer
private  RunnableConsumerThreadPool m_updaterPool
          The RunnableConsumerThreadPool that runs updaters that interpret and update the data
private  long m_userRefreshInterval
          The user refresh interval.
private  java.util.TimerTask m_userTask
          The user refresh timer task
private  int MAX_EVENTS_BEFORE_RESEND
          The maximum number of events that are received before a resend.
private static int NUM_UPDATERS
          The initial number of updater threads
private static java.lang.String USERTIMER
          The id for the user refresh timer task
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
RTCManager()
          The constructor for the RTCManager
 
Method Summary
 void checkTimerTasksOnEventReceipt()
          Check the timer tasks.
static java.util.Map getCategories()
          Gets the categories.
static DataManager getDataManager()
          Gets the data manager.
 DataSender getDataSender()
          Get the data sender.
static RTCManager getInstance()
          Gets the instance of the RTCmanager.
 java.lang.String getName()
          Returns a name/id for this process.
static long getRollingWindow()
          Gets the rolling window.
 int getStatus()
          Returns the current status.
 void incrementCounter()
          Updates the number of events received.
 void init()
           
 void pause()
          Pauses all the threads.
 void resetUserTimer()
          Reset the user timer.
 void resume()
          Resumes all the threads.
 void start()
          Start the RTCManager.
 void stop()
          Stops all the threads.
private  void timerTaskComplete(RTCManager.RTCTimerTask tt)
          Handles a completed task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CATEGORY

private static final java.lang.String LOG4J_CATEGORY
The log4j category used to log debug messsages and statements.

See Also:
Constant Field Values

m_singleton

private static final RTCManager m_singleton
Singleton instance of this class


LOWT_TASK

private static final java.lang.String LOWT_TASK
The id for the low threshold timer task

See Also:
Constant Field Values

HIGHT_TASK

private static final java.lang.String HIGHT_TASK
The id for the high threshold timer task

See Also:
Constant Field Values

USERTIMER

private static final java.lang.String USERTIMER
The id for the user refresh timer task

See Also:
Constant Field Values

NUM_UPDATERS

private static final int NUM_UPDATERS
The initial number of updater threads

See Also:
Constant Field Values

m_rollingWindow

private static long m_rollingWindow
The configurable rolling window read from the properties file


m_timer

private java.util.Timer m_timer
The RTC timer


m_lowTtask

private java.util.TimerTask m_lowTtask
The low threshold timer task


m_lowThresholdInterval

private long m_lowThresholdInterval
The low threshold refresh interval. The low threshold at which data is sent out


m_highTtask

private java.util.TimerTask m_highTtask
The high threshold timer task


m_highThresholdInterval

private long m_highThresholdInterval
The high threshold refresh interval. The high threshold at which data is sent out


m_userTask

private java.util.TimerTask m_userTask
The user refresh timer task


m_userRefreshInterval

private long m_userRefreshInterval
The user refresh interval. The interval at which data is sent even if no events are received


m_counter

private int m_counter
The counter keeping track of the number of messages


MAX_EVENTS_BEFORE_RESEND

private int MAX_EVENTS_BEFORE_RESEND
The maximum number of events that are received before a resend. Note that this or the timers going off, whichever occurs first triggers a resend


m_eventReceiver

private BroadcastEventProcessor m_eventReceiver
The events receiver


m_updaterPool

private RunnableConsumerThreadPool m_updaterPool
The RunnableConsumerThreadPool that runs updaters that interpret and update the data


m_dataSender

private DataSender m_dataSender
The DataSender


m_dataMgr

private static DataManager m_dataMgr
manager of the data maintained by the RTC


m_status

private int m_status
The current status of this fiber

Constructor Detail

RTCManager

public RTCManager()
The constructor for the RTCManager

Method Detail

timerTaskComplete

private void timerTaskComplete(RTCManager.RTCTimerTask tt)
Handles a completed task.

If the low threshold or high threshold timers expire, send category data out and set both timer(task)s to null so they can be reset when the next event comes in

If the user refresh timer is the one that expired, send category data out and reset the user timer(task)

Parameters:
tt - the task that is finishing.

checkTimerTasksOnEventReceipt

public void checkTimerTasksOnEventReceipt()
Check the timer tasks. Reset any of the timer tasks if they need to be reset (indicated by their being set to null on timer task completion). If the events counter has exceeded maxEventsBeforeResend, send data out and reset timers


resetUserTimer

public void resetUserTimer()
Reset the user timer.


getName

public java.lang.String getName()
Returns a name/id for this process.

Specified by:
getName in interface Fiber
Returns:
The name of the Fiber.

getStatus

public int getStatus()
Returns the current status.

Specified by:
getStatus in interface Fiber
Returns:
The current status of the Fiber.

init

public void init()

start

public void start()
Start the RTCManager. Reads the rtc configuration xml, creates and starts all subthreads. Reads and checks all configurable properties. If any of the required properties is not present/incorrect, throws an exception. Creates the DataManager which initializes data from the database and starts the data updater(s) and the data sender

Specified by:
start in interface Fiber

pause

public void pause()
Pauses all the threads.

Specified by:
pause in interface PausableFiber

resume

public void resume()
Resumes all the threads.

Specified by:
resume in interface PausableFiber

stop

public void stop()
Stops all the threads.

Specified by:
stop in interface Fiber

incrementCounter

public void incrementCounter()
Updates the number of events received. Increment the counter that keeps track of number of events received since data was last sent out


getDataSender

public DataSender getDataSender()
Get the data sender.

Returns:
the data sender

getCategories

public static java.util.Map getCategories()
Gets the categories.

Returns:
the categories

getDataManager

public static DataManager getDataManager()
Gets the data manager.

Returns:
the data manager

getRollingWindow

public static long getRollingWindow()
Gets the rolling window.

Returns:
the configured rolling window

getInstance

public static RTCManager getInstance()
Gets the instance of the RTCmanager.

Returns:
the RTCManager singleton.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.