Package org.lsst.ccs.services
Class AgentHeartBeatService
java.lang.Object
org.lsst.ccs.services.AgentHeartBeatService
- All Implemented Interfaces:
HasLifecycle,ServiceLifecycle,AgentService
public class AgentHeartBeatService
extends Object
implements ServiceLifecycle, AgentService, HasLifecycle
A Service to manage the HeartBeat for CCS Agents.
It starts for all agents and its main functions is to publish a HeartBeat
status message every second for transport layers that do not already have a heartbeat
- Author:
- The LSST CCS Team
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidBroadcasts the current heartbeat status.voidbuild()First lifecycle hook.Get the name of this service.int* Returns heartbeat broadcasting period for thisAgent.booleanbooleanstartForAgent(AgentInfo agentInfo) This method is invoked after an agent service is created to see if this service is to be started for the tiven Agent.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.lsst.ccs.framework.HasLifecycle
init, postBuild, postInit, postShutdown, postStart, shutdown, startMethods inherited from interface org.lsst.ccs.ServiceLifecycle
afterBuild, afterInit, afterStart, preBuild, preInit, preShutdown, preStart
-
Field Details
-
AGENT_HEARTBEAT_TASK
- See Also:
-
-
Constructor Details
-
AgentHeartBeatService
public AgentHeartBeatService()
-
-
Method Details
-
getAgentServiceName
Description copied from interface:AgentServiceGet the name of this service. This name will be used to add the given service to the lookup tree.- Specified by:
getAgentServiceNamein interfaceAgentService- Returns:
- the AgentService name.
-
startForAgent
Description copied from interface:AgentServiceThis method is invoked after an agent service is created to see if this service is to be started for the tiven Agent.- Specified by:
startForAgentin interfaceAgentService- Returns:
- true if the service is to be added to the given agent.
-
build
public void build()Description copied from interface:HasLifecycleFirst lifecycle hook. Modification of the component tree is allowed at this stage. After this stage the tree of component cannot be modified anymore. This is where agent periodic tasks should be scheduled.- Specified by:
buildin interfaceHasLifecycle
-
getStatusBroadcastPeriod
public int getStatusBroadcastPeriod()* Returns heartbeat broadcasting period for thisAgent.- Returns:
- period (in seconds) for status broadcasting.
-
broadcastStatus
public final void broadcastStatus()Broadcasts the current heartbeat status. -
isPublishingHeartbeat
public boolean isPublishingHeartbeat()
-