|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.solab.alarms.AbstractAlarmChannel
public abstract class AbstractAlarmChannel
An abstract implementation of AlarmChannel, to ease the creation of custom channels. Defines a minResendInterval of 60 seconds. Subclasses only need to implement the createSendTask(String) method, returning a new Runnable in every call; this Runnable will be queued in a thread pool to be executed as soon as possible, but without interrupting normal program flow. This class already handles what is needed to avoid sending repeated messages very often.
Field Summary | |
---|---|
protected Logger |
log
|
Constructor Summary | |
---|---|
AbstractAlarmChannel()
|
Method Summary | |
---|---|
protected abstract Runnable |
createSendTask(String msg,
String source)
Subclasses need to create and return a new Runnable in each call to this method. |
int |
getMinResendInterval()
Returns the minimum amount of time that must elapse before a previously sent alarm message can be sent again. |
protected abstract boolean |
hasSource(String alarmSource)
This method is used to determine if a certain alarm channel has a special condition for the specified alarmSource or not. |
void |
send(String msg,
String source)
Sends an alarm message for the specified source. |
void |
setMinResendInterval(int millis)
Sets the minimum amount of time between equal messsages. |
void |
shutdown()
Shuts down the thread pool and rejects any more incoming alarms. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Logger log
Constructor Detail |
---|
public AbstractAlarmChannel()
Method Detail |
---|
public void setMinResendInterval(int millis)
public int getMinResendInterval()
getMinResendInterval
in interface AlarmChannel
public void send(String msg, String source)
createSendTask(String, String)
method, no alarm is sent, and no record is made of the
message's last time being sent.
send
in interface AlarmChannel
msg
- The alarm message to be sent.source
- The alarm source. A channel can send the alarm to different recipients depending on the source.
This parameter can be null, which means that it should be sent to the default recipients for the channel.public void shutdown()
shutdown
in interface AlarmChannel
protected abstract Runnable createSendTask(String msg, String source)
msg
- The message to be sent.source
- The alarm source. A channel can have different recipient lists depending on the alarm source.protected abstract boolean hasSource(String alarmSource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |