org.jlab.coda.afecs.agent
Class CRCAgent

java.lang.Object
  extended by org.jlab.coda.afecs.system.ABase
      extended by org.jlab.coda.afecs.archive.AAgent
          extended by org.jlab.coda.afecs.crc.ARepresenter
              extended by org.jlab.coda.afecs.crc.CRCAgent

public class CRCAgent
extends ARepresenter

JSA: Thomas Jefferson National Accelerator Facility
This software was developed under a United States Government license,
described in the NOTICE file included as part of this distribution.
Copyright (c), Aug 17, 2009

Coda component representing agent. This is the specific agent for coda run control, and is programmed having in mind some of the specifics of the runcontrol. Things like thread that waits the state to be set CRCAgent.StateWatchAndReport and the thread that watches the health of the client CRCAgent.WatchClientReportingTime are specific to this agent. This agent also has a preknowledge of the state "Active" and does the eventRate and dataRate average calculations. Single thread monitoring a client state. - ask to "startReporting" if no statistics messages arrive during 10 sec. - switch to P2P mode (puling mode) and request client's state every 2sec. - warining messages to the UI (every 4sec. and after a 1 minute every 10 sec.), and keep taking data in P2P mode. - switch to push mode whenever client starts reporting statistics messages to its agent.

Version:
1.4
Author:
Vardan Gyurjyan

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jlab.coda.afecs.agent.AAgent
AAgent.AsyncProcessThread, AAgent.MonProcessThread, AAgent.ReportDalogThread, AAgent.ReportLoadThread, AAgent.ReportStatusThread, AAgent.ShellExecutionThread
 
Field Summary
 long averageCount
           
 
Fields inherited from class org.jlab.coda.afecs.agent.AAgent
AbortRequest, activeMoveToState, cMsgRequests, me, myLoad, myMonProcesses, myPlugin, myStartTime, ResetRequest
 
Fields inherited from class org.jlab.coda.afecs.system.ABase
myConfig, myCRCClientConnection, myName, myPlatformConnection, myRcDomainConnection
 
Constructor Summary
CRCAgent(AComponent ad)
          Agent is constructed using any available configuration details (at least the name of the agent).
 
Method Summary
 void agentControlRequestAbort(java.lang.String initiator)
          Abstract method of agent service/molvestate abort
 void agentControlRequestClientReconnect(org.jlab.coda.cMsg.cMsgMessage msg)
          New join platform request from the client will trigger this method.
 void agentControlRequestConfigure(AComponent ac)
          Abstract methods implementation Not a CODA configure transition.
 void agentControlRequestMoveToState(java.lang.String state)
           
 void agentControlRequestPlatformDisconnect()
          This will disconnect agent from the platform.
 void agentControlRequestReleaseComponent()
           
 void agentControlRequestReset(java.lang.String initiator)
          Abstract method of agent reset
 void agentControlrequestSetRunNumber(int runnum)
           
 void calculateAverages()
          Calculates average values for event rate and data rate
 void compSubscribe()
           
 void copmUnsubscribe()
           
 void cRcreset()
          General reset
 java.util.ArrayList<java.lang.String> getExpectedComponentReturnedString(java.lang.String requiredState)
          Returns the expected state name described in the cool state description
 void supervisorControlRequestConfigure(AControl control)
           
 
Methods inherited from class org.jlab.coda.afecs.agent.ARepresenter
clientDisconnect, connect2Client, isClientConnected
 
Methods inherited from class org.jlab.coda.afecs.agent.AAgent
configure, connect2cMsg, differentiate, doSubscriptions, executeProcess, executeProcess, executeShellScript, isSet, moveToState, register, removeRegistration, reportLoad, reportStatus, reset, startDalogReporting, startLoadReporting, startStatusReporting, stopDalogReporting, stopLoadReporting, stopMonProcesses, stopStatusReporting, unsubscribeAll
 
Methods inherited from class org.jlab.coda.afecs.system.ABase
B2O, connect, connect, connect, dalogMsg, dalogMsg, disconnect, getCurrentTime, getCurrentTime, getCurrentTimeInMs, getPlDescription, getPlEXPID, getPlMulticastUDL, getPlUDL, isConnected, isRCDomainConnected, msg2xml, msgForward, multicastConnect, multicastConnect, O2B, p2pSend, p2pSend, p2pSend, p2pSend, rcConnect, rcDomaindisconnect, rcMonitor, rcp2pSend, rcSend, rcSend, rcSend, rcSend, rcSend, rcSend, rcSend, removeUnixShellProcess, reporAlarmMsg, reportAlarmMsg, reportAlarmMsg, runShellCommand, send, send, send, send, send, send, send, sleep, updateHostUdl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

averageCount

public long averageCount
Constructor Detail

CRCAgent

public CRCAgent(AComponent ad)
Agent is constructed using any available configuration details (at least the name of the agent).

Parameters:
ad - AComponent object
Method Detail

agentControlRequestAbort

public void agentControlRequestAbort(java.lang.String initiator)
Description copied from class: AAgent
Abstract method of agent service/molvestate abort

Specified by:
agentControlRequestAbort in class AAgent
Parameters:
initiator - agent name who initiates the reset

agentControlRequestClientReconnect

public void agentControlRequestClientReconnect(org.jlab.coda.cMsg.cMsgMessage msg)
New join platform request from the client will trigger this method.

Specified by:
agentControlRequestClientReconnect in class AAgent
Parameters:
msg - cMsgMessage object

agentControlRequestConfigure

public void agentControlRequestConfigure(AComponent ac)
Abstract methods implementation Not a CODA configure transition. This is COOL specific setup CODA configure state transition will be requested through agentControlRequestMoveToState method

Specified by:
agentControlRequestConfigure in class AAgent
Parameters:
ac - AComponent refference

agentControlRequestMoveToState

public void agentControlRequestMoveToState(java.lang.String state)
Specified by:
agentControlRequestMoveToState in class AAgent

agentControlRequestPlatformDisconnect

public void agentControlRequestPlatformDisconnect()
Description copied from class: AAgent
This will disconnect agent from the platform. i.e. it will be garbage collected.

Specified by:
agentControlRequestPlatformDisconnect in class AAgent

agentControlRequestReleaseComponent

public void agentControlRequestReleaseComponent()
Specified by:
agentControlRequestReleaseComponent in class AAgent

agentControlRequestReset

public void agentControlRequestReset(java.lang.String initiator)
Description copied from class: AAgent
Abstract method of agent reset

Specified by:
agentControlRequestReset in class AAgent
Parameters:
initiator - agent name who initiates the reset

agentControlrequestSetRunNumber

public void agentControlrequestSetRunNumber(int runnum)
Specified by:
agentControlrequestSetRunNumber in class AAgent

calculateAverages

public void calculateAverages()
Calculates average values for event rate and data rate


compSubscribe

public void compSubscribe()

copmUnsubscribe

public void copmUnsubscribe()

cRcreset

public void cRcreset()
General reset


getExpectedComponentReturnedString

public java.util.ArrayList<java.lang.String> getExpectedComponentReturnedString(java.lang.String requiredState)
Returns the expected state name described in the cool state description

Parameters:
requiredState - actual state name to be transitioned
Returns:
the name that user gave to the required state at the physical client level

supervisorControlRequestConfigure

public void supervisorControlRequestConfigure(AControl control)
Specified by:
supervisorControlRequestConfigure in class AAgent