Class AgentConnectionTrackingServiceImpl
java.lang.Object
com.netflix.genie.web.agent.services.impl.AgentConnectionTrackingServiceImpl
- All Implemented Interfaces:
AgentConnectionTrackingService
,org.springframework.boot.actuate.info.InfoContributor
public class AgentConnectionTrackingServiceImpl
extends Object
implements AgentConnectionTrackingService, org.springframework.boot.actuate.info.InfoContributor
This service keeps track of agent connections and heartbeats. It notifies the downstream
AgentRoutingService
of connected/disconnected agents while hiding details of connections, disconnections, missed heartbeats.- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionAgentConnectionTrackingServiceImpl
(AgentRoutingService agentRoutingService, org.springframework.scheduling.TaskScheduler taskScheduler, AgentConnectionTrackingServiceProperties serviceProperties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
contribute
(org.springframework.boot.actuate.info.Info.Builder builder) long
Get the count of locally connected agents.void
notifyDisconnected
(String streamId, String claimedJobId) Handle a disconnection.void
notifyHeartbeat
(String streamId, String claimedJobId) Handle a heartbeat.
-
Constructor Details
-
AgentConnectionTrackingServiceImpl
public AgentConnectionTrackingServiceImpl(AgentRoutingService agentRoutingService, org.springframework.scheduling.TaskScheduler taskScheduler, AgentConnectionTrackingServiceProperties serviceProperties) Constructor.- Parameters:
agentRoutingService
- the agent routing servicetaskScheduler
- the task schedulerserviceProperties
- the service properties
-
-
Method Details
-
notifyHeartbeat
Handle a heartbeat.- Specified by:
notifyHeartbeat
in interfaceAgentConnectionTrackingService
- Parameters:
streamId
- the unique id of the connectionclaimedJobId
- the job id claimed by the agent
-
notifyDisconnected
Handle a disconnection.- Specified by:
notifyDisconnected
in interfaceAgentConnectionTrackingService
- Parameters:
streamId
- the unique id of the connectionclaimedJobId
- the job id claimed by the agent
-
getConnectedAgentsCount
public long getConnectedAgentsCount()Get the count of locally connected agents.- Specified by:
getConnectedAgentsCount
in interfaceAgentConnectionTrackingService
- Returns:
- the number of agents connected.
-
contribute
public void contribute(org.springframework.boot.actuate.info.Info.Builder builder) - Specified by:
contribute
in interfaceorg.springframework.boot.actuate.info.InfoContributor
-