Class AlarmSource

Object
com.tailf.ncs.alarmman.consumer.AlarmSource
All Implemented Interfaces:
AutoCloseable

public class AlarmSource extends Object implements AutoCloseable
This class establishes a listener queue for emitted alarms. It requires the AlarmSourceCentral to be started, which will submit the alarms to the queue
  • Constructor Details

    • AlarmSource

      public AlarmSource()
      Use the AlarmSourceCentral from the thread local NcsMain object.
    • AlarmSource

      public AlarmSource(AlarmSourceCentral sourceCentral)
      Use a specific AlarmSourceCentral.
  • Method Details

    • takeAlarm

      public Alarm takeAlarm() throws InterruptedException

      Retrieves or waiting if necessary until an Alarm becomes available.

      Blocks the current thread indefinitely until the operation can succeed.

      Returns:
      Alarm
      Throws:
      InterruptedException
    • pollAlarm

      public Alarm pollAlarm(int time, TimeUnit unit) throws InterruptedException
      Parameters:
      time -
      unit -
      Returns:
      Alarm
      Throws:
      InterruptedException
    • startListening

      public void startListening()
    • stopListening

      public void stopListening()
    • isListening

      public boolean isListening()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable