Classes | Public Member Functions | Static Public Attributes | Protected Attributes

alma.acs.alarmsystem.source.AlarmsMap Class Reference

List of all members.

Classes

class  AlarmInfo
class  AlarmsMapRunnable

Public Member Functions

 AlarmsMap (ThreadFactory threadFactory, Logger logger)
Collection< String > getActiveAlarms ()
boolean raise (String alarmID)
boolean clear (String alarmID)
void start ()
void shutdown ()
int size ()
boolean containsKey (Object key)
void clear ()
AlarmInfo get (Object key)

Static Public Attributes

static final int ALARM_ACTIVITY_TIME = 30

Protected Attributes

final Map< String, AlarmInfoalarms = new ConcurrentHashMap<String, AlarmsMap.AlarmInfo>()

Detailed Description

The map of active and inactive alarms.

Alarms that are not updated after ALARM_ACTIVITY_TIME are removed from the map so that they will be sent again to the alarm service.

The class is thread safe i.e. the methods can be called without any further locking.

AlarmsMap does not need any locking because the map contains immutable AlarmInfo objects and the map itself is implemented by a ConcurrentHashMap.

Author:
acaproni

Constructor & Destructor Documentation

alma.acs.alarmsystem.source.AlarmsMap.AlarmsMap ( ThreadFactory  threadFactory,
Logger  logger 
)

Constructor

Parameters:
threadFactory The thread factory to schedule the timer loop
logger The logger

References alma.acs.alarmsystem.source.AlarmsMap.ALARM_ACTIVITY_TIME.


Member Function Documentation

boolean alma.acs.alarmsystem.source.AlarmsMap.clear ( String  alarmID  ) 

An alarms has been cleared and must be added to the map.

Parameters:
alarmID The ID of the alarm
Returns:
true if the alarm with the give ID was already present in the list and it was terminated; false otherwise.

References alma.acs.alarmsystem.source.AlarmsMap.AlarmInfo.active, and alma.acs.alarmsystem.source.AlarmsMap.alarms.

void alma.acs.alarmsystem.source.AlarmsMap.clear (  ) 
boolean alma.acs.alarmsystem.source.AlarmsMap.containsKey ( Object  key  ) 
Parameters:
key The key to look for in the map
Returns:
true if the map contains an item with the given ket

References alma.acs.alarmsystem.source.AlarmsMap.alarms.

AlarmInfo alma.acs.alarmsystem.source.AlarmsMap.get ( Object  key  ) 
Parameters:
key The key to look for
Returns:
The object with the given key

References alma.acs.alarmsystem.source.AlarmsMap.alarms.

Collection<String> alma.acs.alarmsystem.source.AlarmsMap.getActiveAlarms (  ) 

Return the active alarms in the map

Returns:
the active alarms in the map

References alma.acs.alarmsystem.source.AlarmsMap.alarms.

Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.terminateAllAlarms().

boolean alma.acs.alarmsystem.source.AlarmsMap.raise ( String  alarmID  ) 

An alarms has been raised and must be added to the map.

Parameters:
alarmID The ID of the alarm
Returns:
true if the alarm with the give ID was already present in the list and it was active; false otherwise.

References alma.acs.alarmsystem.source.AlarmsMap.AlarmInfo.active, and alma.acs.alarmsystem.source.AlarmsMap.alarms.

Referenced by alma.acs.alarmsystem.source.AlarmSourceImpl.raiseAlarm().

void alma.acs.alarmsystem.source.AlarmsMap.shutdown (  ) 
int alma.acs.alarmsystem.source.AlarmsMap.size (  ) 

The size of the map

Returns:
The size of the map
See also:
ConcurrentHashMap.size()

References alma.acs.alarmsystem.source.AlarmsMap.alarms.

void alma.acs.alarmsystem.source.AlarmsMap.start (  ) 

Member Data Documentation

The alarms that have no activity after the following time interval are removed from the map.

In practice, it means that an alarm with the same state will be sent again if it arrives after ALARM_ACTIVITY_TIME seconds.

Referenced by alma.acs.alarmsystem.source.AlarmsMap.AlarmsMap(), alma.acs.alarmsystem.source.AlarmsMap.AlarmsMapRunnable.run(), and alma.acs.alarmsystem.source.AlarmsMap.shutdown().

final Map<String, AlarmInfo> alma.acs.alarmsystem.source.AlarmsMap.alarms = new ConcurrentHashMap<String, AlarmsMap.AlarmInfo>() [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties