public class StatsCalculator
extends java.lang.Object
implements java.lang.Runnable
The statistics are
StatsCalculator logs a minimal set of statistics on the logging system
but the full statistics are saved on the file.
Statistics are logged every time interval whose default is 10 minutes.
The time interval can be customized by setting the "alma.acs.alarmsystem.statistics.timeinterval" java property.
A time interval of 0 minutes disable the logging of statistics (@see "alma.acs.alarmsystem.statistics.timeinterval").
The log level is INFO by default but can be customized by setting the LOGLEVELPROPNAME
java property.
Statistics logged on file are more complete then those logged.
The number of activations and terminations of each alarm received during the time interval is stored
in the alarmsMap map.
Life cycle:
start() must be called to start gathering statistics and shutdown() must be
executed when finished.
| Modifier and Type | Field and Description |
|---|---|
static AcsLogLevel |
DEFAULTLOGLEVEL
The default log level
|
static int |
DEFAULTTIMEINTERVAL
The default time interval is 10 minutes
|
static java.lang.String |
LOGLEVELPROPNAME
The name of the property to customize the the level of the logs with the
statistics.
|
int |
timeInterval
Statistics are logged every time interval (in minutes)
|
static java.lang.String |
TIMEINTERVALPROPNAME
The name of the property to customize the time interval (in minutes) to log
statistics.
|
| Constructor and Description |
|---|
StatsCalculator(java.util.logging.Logger logger,
AlarmSourcesListenerCached sourceNCQueue)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
msgFromSourceNCReceived()
A message from the source NC has been received.
|
void |
processedFS(java.lang.String alarmID,
boolean active)
An FaultState with the passed ID and activation state
has been processed.
|
void |
run()
The scheduler invokes this method at fixed time intervals to generate and publish statistics.
|
void |
shutdown()
This method must be called when no more statistics must be collected and
published.
|
void |
start()
Start to collect statistics and spawn the timer task.
|
public static final java.lang.String TIMEINTERVALPROPNAME
0 disables the statistics.public static final int DEFAULTTIMEINTERVAL
public final int timeInterval
public static final java.lang.String LOGLEVELPROPNAME
The value of this level can be a string (like Debug) or a integer (like 5 for Notice).
See AcsLogLevelDefinition for further details
public static final AcsLogLevel DEFAULTLOGLEVEL
public StatsCalculator(java.util.logging.Logger logger,
AlarmSourcesListenerCached sourceNCQueue)
logger - The loggerpublic void processedFS(java.lang.String alarmID,
boolean active)
For the statistics, StatsCalculator does not distinguish if a
alarm is a change (@see AlarmMessageProcessorImpl.processChange(cern.laser.source.alarmsysteminterface.FaultState, String, String, java.sql.Timestamp)
or a backup (AlarmMessageProcessorImpl#processBackup(...)).
alarmID - The ID of the received alarmactive - The status of the alarm (true means active)public void msgFromSourceNCReceived()
public void start()
public void shutdown()
public void run()
run in interface java.lang.Runnable