Class AlarmSinkCentral

Object
com.tailf.ncs.alarmman.producer.AlarmSinkCentral
All Implemented Interfaces:
AutoCloseable, Runnable

public class AlarmSinkCentral extends Object implements Runnable, AutoCloseable
An AlarmSinkCentral represent a central "proxy" for created AlarmSink's.

When AlarmSink's is created ( with the default constructor ), they are attched to the AlarmSinkCentral singleton instance which writes alarms directly into the alarm list on behalf of the attached AlarmSink instances. The benefit of using the AlarmSinkCentral is:

  • User do not need to create Cdb objects when creating AlarmSink
  • Possible to buffer alarms for faster throughput.
NOTE: A AlarmSinkCentral is available in NCS JVM. When specifying the queue size the amount alarm will be queued before it is written to Cdb. Alarms are written to a blocking queue within the same JVM as the NCS. The NCS writes the alarms down into the CDB.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AlarmSinkCentral(int alarmQueueLen, Maapi maapi)
    Creates an NCS alarm sink.
    AlarmSinkCentral(int alarmQueueLen, Maapi maapi, int alarmBufSize, long alarmBufTimeout)
    Creates an NCS alarm sink.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the alarm sink central by stopping the processing thread.
    Returns the alarm queue.
    boolean
    Checks if the alarm sink central thread is currently alive and running.
    boolean
    Requests the alarm sink central to stop processing alarms.
    void
    run()
    Main thread execution method that processes alarms from the queue.
    void
    Starts the alarm sink central thread for processing alarms.
    void
    Stops the alarm sink central thread and waits for it to terminate.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AlarmSinkCentral

      public AlarmSinkCentral(int alarmQueueLen, Maapi maapi)
      Creates an NCS alarm sink.
      Parameters:
      alarmQueueLen - the maximum length of the queue.
      maapi - the Maapi instance used to write alarm info
    • AlarmSinkCentral

      public AlarmSinkCentral(int alarmQueueLen, Maapi maapi, int alarmBufSize, long alarmBufTimeout)
      Creates an NCS alarm sink.
      Parameters:
      alarmQueueLen - the maximum length of the queue.
      maapi - the Maapi instance used to write alarm info
      alarmBufSize - the size of the alarm buffer
      alarmBufTimeout - timeout in seconds after which the buffer will be submitted if there are no new alarms in the queue
  • Method Details

    • getQueue

      public ArrayBlockingQueue<Alarm> getQueue()
      Returns the alarm queue.
      Returns:
      the current alarm queue.
    • start

      public void start()
      Starts the alarm sink central thread for processing alarms. Creates and starts a daemon thread if not already running.
    • isAlive

      public boolean isAlive()
      Checks if the alarm sink central thread is currently alive and running.
      Returns:
      true if the thread is alive, false otherwise
    • requestStop

      public boolean requestStop()
      Requests the alarm sink central to stop processing alarms.
      Returns:
      true if the stop request was successful
    • stop

      public void stop()
      Stops the alarm sink central thread and waits for it to terminate. Sends a termination signal to the queue and waits for the thread to join.
    • run

      public void run()
      Main thread execution method that processes alarms from the queue.
      Specified by:
      run in interface Runnable
    • close

      public void close()
      Closes the alarm sink central by stopping the processing thread.
      Specified by:
      close in interface AutoCloseable