Classes | |
class | OscillationTask |
class | QueueFlusherTask |
Public Member Functions | |
AlarmSourceImpl (ContainerServicesBase containerServices) | |
void | raiseAlarm (String faultFamily, String faultMember, int faultCode) |
void | raiseAlarm (String faultFamily, String faultMember, int faultCode, Properties properties) |
void | clearAlarm (String faultFamily, String faultMember, int faultCode) |
void | setAlarm (String faultFamily, String faultMember, int faultCode, Properties alarmProps, boolean active) |
void | setAlarm (String faultFamily, String faultMember, int faultCode, boolean active) |
void | terminateAllAlarms () |
synchronized void | queueAlarms (long delayTime, TimeUnit unit) |
void | queueAlarms () |
synchronized void | flushAlarms () |
void | disableAlarms () |
void | enableAlarms () |
void | start () |
void | tearDown () |
Static Public Attributes | |
static final int | ALARM_OSCILLATION_TIME = 1 |
The implementation of AlarmSource.
Flushing of queued alarms is done by a thread to avoid blocking the caller if there are too many queued alarm. There is possible critical race if the user executes a sequence of queueAlarms()/flushAlarms(), it happens if the queueAlarms() is called when the the thread has not yet finished flushing the alarms. This is avoided by copying the alarms in AlarmSourceImpl#queue in a temporary immutable vector.
alma.acs.alarmsystem.source.AlarmSourceImpl.AlarmSourceImpl | ( | ContainerServicesBase | containerServices | ) |
Constructor
containerServices | The container services |
References alma.acs.alarmsystem.source.AlarmSourceImpl.ALARM_OSCILLATION_TIME, alma.acs.container.ContainerServicesBase.getLogger(), and alma.acs.container.ContainerServicesBase.getThreadFactory().
void alma.acs.alarmsystem.source.AlarmSourceImpl.clearAlarm | ( | String | faultFamily, | |
String | faultMember, | |||
int | faultCode | |||
) |
The alarm to clear is not sent directly to the alarm service. It is instead queued in AlarmSourceImpl#alarmsToClean and will be cleared by the oscillation loop.
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmQueue.add().
Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm(), and alma.acs.alarmsystem.source.AlarmSourceImpl.terminateAllAlarms().
void alma.acs.alarmsystem.source.AlarmSourceImpl.disableAlarms | ( | ) |
Disable the sending of alarms.
When the alarms are disabled, all the alarms submitted with raise, clear and set are discarded. This means that those alarms are immediately discarded. They are not queued, and will never arrive at the alarm service.
Implements alma.acs.alarmsystem.source.AlarmSource.
void alma.acs.alarmsystem.source.AlarmSourceImpl.enableAlarms | ( | ) |
Enable the sending of alarms.
Better just "This method reverts the effect of a previous call to disableAlarms(), so that alarms will get processed again.
Alarms are enabled by default.
Implements alma.acs.alarmsystem.source.AlarmSource.
synchronized void alma.acs.alarmsystem.source.AlarmSourceImpl.flushAlarms | ( | ) |
Flush the alarms queued and stop queuing.
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.container.ContainerServicesBase.getThreadFactory().
Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.queueAlarms().
void alma.acs.alarmsystem.source.AlarmSourceImpl.queueAlarms | ( | ) |
Start queuing the alarms.
The alarms are queued until flushAlarms()
is executed.
The purpose of the queuing is to avoid alarms flickering for example during the initialization phase of a device where spurious states could trigger the event of false alarms.
Implements alma.acs.alarmsystem.source.AlarmSource.
synchronized void alma.acs.alarmsystem.source.AlarmSourceImpl.queueAlarms | ( | long | delayTime, | |
TimeUnit | unit | |||
) |
Start queuing the alarms.
The alarms are flushed when the passed time expires or flush gets called.
The purpose of the queuing is to avoid alarms flickering for example during the initialization phase of a device where spurious states could trigger the event of false alarms
delayTime | The time to queue alarms | |
unit | The unit of the delay |
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmSourceImpl.flushAlarms().
void alma.acs.alarmsystem.source.AlarmSourceImpl.raiseAlarm | ( | String | faultFamily, | |
String | faultMember, | |||
int | faultCode, | |||
Properties | properties | |||
) |
Raise an alarm with the given triplet and a set of properties.
If the alarm is already active, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
properties | The user properties. It can be null or empty. |
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmQueue.add(), alma.acs.alarmsystem.source.AlarmsMap.raise(), and alma.acs.alarmsystem.source.AlarmSender.sendAlarm().
void alma.acs.alarmsystem.source.AlarmSourceImpl.raiseAlarm | ( | String | faultFamily, | |
String | faultMember, | |||
int | faultCode | |||
) |
Raise an alarm with the given triplet.
If the alarm is already active, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode |
Implements alma.acs.alarmsystem.source.AlarmSource.
Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm().
void alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm | ( | String | faultFamily, | |
String | faultMember, | |||
int | faultCode, | |||
Properties | alarmProps, | |||
boolean | active | |||
) |
Send the alarm with the passed triplet and properties to the alarm service. The state activate/terminate of the alarm depends on the passed boolean.
This method is the most complete way to send an alarm.
If the alarm is already active, it is not sent again to the alarm service. If the alarm is already terminated, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
alarmProps | The user properties. It can be null or empty. | |
active | if true the alarm is activated otherwise it is terminated. |
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmSourceImpl.clearAlarm(), and alma.acs.alarmsystem.source.AlarmSourceImpl.raiseAlarm().
Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm().
void alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm | ( | String | faultFamily, | |
String | faultMember, | |||
int | faultCode, | |||
boolean | active | |||
) |
Send the alarm with the passed triplet to the alarm service. The state activate/terminate of the alarm depends on the passed boolean.
This method is the most complete way to send an alarm.
If the alarm is already active, it is not sent again to the alarm service. If the alarm is already terminated, it is not sent again to the alarm service.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
active | if true the alarm is activated otherwise it is terminated. |
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmSourceImpl.setAlarm().
void alma.acs.alarmsystem.source.AlarmSourceImpl.start | ( | ) |
Start the threads
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.concurrent.ThreadLoopRunner.runLoop(), alma.acs.concurrent.ThreadLoopRunner.setDelayMode(), and alma.acs.alarmsystem.source.AlarmsMap.start().
void alma.acs.alarmsystem.source.AlarmSourceImpl.tearDown | ( | ) |
Life-cycle: tearDown must be called when terminated using this class
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmSender.close(), alma.acs.alarmsystem.source.AlarmsMap.shutdown(), and alma.acs.concurrent.ThreadLoopRunner.shutdown().
void alma.acs.alarmsystem.source.AlarmSourceImpl.terminateAllAlarms | ( | ) |
Terminate all the active alarms.
Implements alma.acs.alarmsystem.source.AlarmSource.
References alma.acs.alarmsystem.source.AlarmSourceImpl.clearAlarm(), and alma.acs.alarmsystem.source.AlarmsMap.getActiveAlarms().
final int alma.acs.alarmsystem.source.AlarmSourceImpl.ALARM_OSCILLATION_TIME = 1 [static] |
To limit the effect of oscillations, publishing of inactive alarms is delayed of ALARM_OSCILLATION_TIME
(in seconds)
If during this time interval, the alarm is activated again then it will not be deactivated.
Visibility is public for testing purposes.
Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.AlarmSourceImpl().