Package com.tailf.ncs.alarmman.consumer
Class AlarmSource
Object
com.tailf.ncs.alarmman.consumer.AlarmSource
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionUse the AlarmSourceCentral from the thread local NcsMain object.AlarmSource
(AlarmSourceCentral sourceCentral) Use a specific AlarmSourceCentral. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
void
void
Retrieves or waiting if necessary until an Alarm becomes available.
-
Constructor Details
-
AlarmSource
public AlarmSource()Use the AlarmSourceCentral from the thread local NcsMain object. -
AlarmSource
Use a specific AlarmSourceCentral.
-
-
Method Details
-
takeAlarm
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
- 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 interfaceAutoCloseable
-