konark.detectors
Class FailureEventDetector

java.lang.Object
  extended bykonark.detectors.EventDetector
      extended bykonark.detectors.FailureEventDetector
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class FailureEventDetector
extends EventDetector

The FailureEvent Detector can monitor agents and detectors for failure. A detector fails if its TTL expires. An agent fails if all its detectors have failed (TTLs expired). This detector generates FailureEvents.

See Also:
FailureEvent, Serialized Form

Field Summary
protected  java.util.Hashtable checkPoint
           
protected  boolean firstFailureEvent
           
protected  int numOfAgents
           
protected  int runningCountNumOfAgents
           
protected  boolean startExp
           
protected  java.util.Hashtable uniqueAgentAliveTable
           
 
Fields inherited from class konark.detectors.EventDetector
agentURN, blueToothLogFileName, cred, dbModule, eventIDGenerator, eventTable, host, localTriggeringEvents, remoteTriggeringEvents, reportTable
 
Constructor Summary
FailureEventDetector(java.util.Hashtable agentHashtable, ConfigObject configObj)
          The default constructor.
 
Method Summary
 Event createEvent(ajanta.naming.URN fieldAgentURN, java.util.Vector failedDetectorNames, int seq, java.util.Vector sourceURNList)
           
 java.util.Vector generateEvent(Event triggeredEvent)
          generateEvent checks to see if a FailureEvent should be generated.
 java.lang.String getGeneratingEventClassName()
          Returns the fully-qualified classname of the event that this detector may generate.
 void modifyDetector(java.lang.Object object)
          This method allows us to customize the detector.
 
Methods inherited from class konark.detectors.EventDetector
getAlarmLevel, getAlertLevel, getBlueToothLogFileLocation, getLocalTriggeringEventClassNames, getRemoteTriggeringEventClassNames, getRFIDLogFileLocation, getSynchronizer, InitializeFields, modifyDetector, populatePatterns, printRunningThreads, run, setAgentURN, setAlarmLevel, setAlertLevel, setBlueToothLogFileLocation, setDB, setEventIDGenerator, setEventTable, setLocalTriggeringEvents, setRemoteTriggeringEvents, setReportTable, setRFIDLogFileLocation, stopDetector, switchOffPrintRunningThreads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checkPoint

protected java.util.Hashtable checkPoint

firstFailureEvent

protected boolean firstFailureEvent

startExp

protected boolean startExp

numOfAgents

protected int numOfAgents

runningCountNumOfAgents

protected int runningCountNumOfAgents

uniqueAgentAliveTable

protected java.util.Hashtable uniqueAgentAliveTable
Constructor Detail

FailureEventDetector

public FailureEventDetector(java.util.Hashtable agentHashtable,
                            ConfigObject configObj)
The default constructor. Takes in a hashtable of agents and detectorStatus elements, each of which will be monitored for failure.

Parameters:
agentHashtable - hashtable, keys agent URNs, values, DetectorStatus vectors.
Method Detail

getGeneratingEventClassName

public java.lang.String getGeneratingEventClassName()
Returns the fully-qualified classname of the event that this detector may generate.

Specified by:
getGeneratingEventClassName in class EventDetector
Returns:
the fully-qualified classname of the event that this detector may generate.

generateEvent

public java.util.Vector generateEvent(Event triggeredEvent)
generateEvent checks to see if a FailureEvent should be generated. It may be triggered by TimerEvent or AgentAliveEvent. In the case of TimerEvent, we check to see if its Time To Live has expired; if it has, we generate a FailureEvent. In the case of AgentAliveEvent, we will reset the TTL to its default start state if the agent is not in its initial mode.

Specified by:
generateEvent in class EventDetector
Parameters:
triggeredEvent - the event that triggered this detector.
Returns:
the vector of generated FailureEvents.

createEvent

public Event createEvent(ajanta.naming.URN fieldAgentURN,
                         java.util.Vector failedDetectorNames,
                         int seq,
                         java.util.Vector sourceURNList)

modifyDetector

public void modifyDetector(java.lang.Object object)
This method allows us to customize the detector. If passed a ConfigurationChangeObject, the detector will try to add or delete detectors or agents to its monitoring state, based on the setup of the CCO.

Parameters:
object - the ConfigurationChangeObject that controls modification.
See Also:
network.ConfigurationChangeObject