public class BaseAlarmsSender
extends java.lang.Object
BaseAlarmsSender starts a thread, alarmsSenderThread, to randomly set/clear the alarms whose definition
is read from the file.
There is only one thread alive at a given time. So if the user want to start a task,
he must wait the termination of the current task or stop it.
Default fault members have a '*' in the FM of the triplet. Default fault members are used only while cycling
i.e. when activating or terminating all the alarms they are ignored.
The fault member name of a default is built by appending a random number to the prefix name, defaultFMNamePrefix.
This means that the user must clean default fault members by using the table of alarms.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BaseAlarmsSender.AlarmRead
An alarm read from the file or the TM/CDB.
|
protected static class |
BaseAlarmsSender.AlarmSenderThreadFactory
The thread factory to create threads for sending alarms.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Vector<BaseAlarmsSender.AlarmRead> |
alarms
The alarms read from the file.
|
protected ParallelAlarmSender |
alarmsSender
The object to send alarms
|
protected java.lang.Thread |
alarmsSenderThread
The thread to send alarms.
|
protected ContainerServices |
contSvcs
ContainerServices
|
protected java.lang.String |
defaultFMNamePrefix
The prefix of a fault member generated from a default
|
protected java.util.Set<SlowTaskListener> |
listeners
The listeners to notify when alarms have been sent to the alarm system.
|
protected int |
maxDefaultFMSuffix
The max number appended to the prefix to build a fault member with a default
|
protected SenderPanel |
panel
The parent component to show the dialog
|
protected BaseAlarmsSender.AlarmSenderThreadFactory |
threadFactory
The factory to create threads
|
| Constructor and Description |
|---|
BaseAlarmsSender(SenderPanel parent,
ContainerServices contSvcs,
ParallelAlarmSender sender,
java.lang.String threadPrefixName)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addSlowTaskListener(SlowTaskListener listener)
Add a not
null listener. |
void |
close()
Stop the thread and frees the resources
|
protected void |
dumpAlarms()
Print on the stdout the alarms
InterruptedException alarms |
protected void |
notifyAlarmsRead()
Notify the listeners that the alarms have been read from the file
or the TM/CDB
|
protected void |
notifyStartTask(java.lang.Integer nSteps)
Notify the listeners that a slow task started.
|
protected void |
notifyStopTask()
Notify the listeners that a slow task terminated.
|
protected void |
notifyTaskProgress(int currentStep)
Notify the listeners that a slow task terminated.
|
boolean |
removeSlowTaskListener(SlowTaskListener listener)
Remove a listener.
|
void |
sendAlarms(boolean active)
Send the alarms read from the file.
|
int |
size() |
void |
startSendingRandomly()
Start sending alarms randomly.
|
void |
stopThread()
Stop the thread to send alarms
|
protected final java.lang.String defaultFMNamePrefix
protected final int maxDefaultFMSuffix
This is also the max number of alarms that can be generated for a default fault member
i.e. an alarm like FF,*,1 can be translated into at most maxDefaultFMSuffix alarms
protected final ContainerServices contSvcs
protected final ParallelAlarmSender alarmsSender
protected final SenderPanel panel
protected final BaseAlarmsSender.AlarmSenderThreadFactory threadFactory
protected volatile java.lang.Thread alarmsSenderThread
protected final java.util.Vector<BaseAlarmsSender.AlarmRead> alarms
protected final java.util.Set<SlowTaskListener> listeners
public BaseAlarmsSender(SenderPanel parent, ContainerServices contSvcs, ParallelAlarmSender sender, java.lang.String threadPrefixName)
parent - the parent component of the dialogcontSvcs - The ContainerServicessender - The object to send alarmsthreadPrefixName - The prefix of the name of the threadpublic void stopThread()
public boolean addSlowTaskListener(SlowTaskListener listener)
null listener.listener - The listener to be notifiedtrue if this set did not already contain the specified elementpublic boolean removeSlowTaskListener(SlowTaskListener listener)
listener - The not null listener to removetrue if this set contained the specified elementpublic void close()
protected void notifyStartTask(java.lang.Integer nSteps)
nSteps - The number of steps or null if undefined.protected void notifyStopTask()
protected void notifyTaskProgress(int currentStep)
currentStep - The actual stepprotected void notifyAlarmsRead()
public int size()
protected void dumpAlarms()
InterruptedException alarmspublic void sendAlarms(boolean active)
active - if true the alarms are activated,
otherwise terminatedpublic void startSendingRandomly()
The triplet of alarms are those set in the file but they are picked up randomly in a loop. The activation state (ACTIVE, TERMINATE) is also chosen randomly