Class AgentRoutingServiceCuratorDiscoveryImpl
java.lang.Object
com.netflix.genie.web.agent.services.impl.AgentRoutingServiceCuratorDiscoveryImpl
- All Implemented Interfaces:
AgentRoutingService
Implementation of
AgentRoutingService that relies on Curator's Discovery extension.
Rather than the traditional use of this recipe (register a service for the node itself, this class registers one
service instance for each agent locally connected.- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classPayload for typedServiceDiscovery. -
Constructor Summary
ConstructorsConstructorDescriptionAgentRoutingServiceCuratorDiscoveryImpl(GenieHostInfo genieHostInfo, org.apache.curator.x.discovery.ServiceDiscovery<AgentRoutingServiceCuratorDiscoveryImpl.Agent> serviceDiscovery, org.springframework.scheduling.TaskScheduler taskScheduler, org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.state.ConnectionStateListener> listenableCuratorConnectionState, io.micrometer.core.instrument.MeterRegistry registry, AgentRoutingServiceProperties properties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetHostnameForAgentConnection(@NotBlank String jobId) Look up the hostname of the Genie node currently handling the agent connection for a given job.voidhandleClientConnected(@NotBlank String jobId) Handle a new agent connection.voidhandleClientDisconnected(@NotBlank String jobId) Handle connected agent disconnection.booleanisAgentConnected(String jobId) Whether the agent executing a given job is currently connected.booleanisAgentConnectionLocal(@NotBlank String jobId) Tells whether the agent running a given job is connected to the local node.
-
Constructor Details
-
AgentRoutingServiceCuratorDiscoveryImpl
public AgentRoutingServiceCuratorDiscoveryImpl(GenieHostInfo genieHostInfo, org.apache.curator.x.discovery.ServiceDiscovery<AgentRoutingServiceCuratorDiscoveryImpl.Agent> serviceDiscovery, org.springframework.scheduling.TaskScheduler taskScheduler, org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.state.ConnectionStateListener> listenableCuratorConnectionState, io.micrometer.core.instrument.MeterRegistry registry, AgentRoutingServiceProperties properties) Constructor.- Parameters:
genieHostInfo- The genie local host informationserviceDiscovery- The service discovery clienttaskScheduler- The task schedulerlistenableCuratorConnectionState- The listenable curator client connection statusregistry- The metrics registryproperties- The service properties
-
-
Method Details
-
getHostnameForAgentConnection
Look up the hostname of the Genie node currently handling the agent connection for a given job.- Specified by:
getHostnameForAgentConnectionin interfaceAgentRoutingService- Parameters:
jobId- the job id- Returns:
- a boxed hostname string, empty if the connection for the given job id is not found
-
isAgentConnectionLocal
Tells whether the agent running a given job is connected to the local node.- Specified by:
isAgentConnectionLocalin interfaceAgentRoutingService- Parameters:
jobId- the job id- Returns:
- true if the agent has an active connection to this node
-
handleClientConnected
Description copied from interface:AgentRoutingServiceHandle a new agent connection.- Specified by:
handleClientConnectedin interfaceAgentRoutingService- Parameters:
jobId- the job id the connected agent is running
-
handleClientDisconnected
Description copied from interface:AgentRoutingServiceHandle connected agent disconnection.- Specified by:
handleClientDisconnectedin interfaceAgentRoutingService- Parameters:
jobId- the job id the disconnected agent is running
-
isAgentConnected
Whether the agent executing a given job is currently connected.- Specified by:
isAgentConnectedin interfaceAgentRoutingService- Parameters:
jobId- the job id- Returns:
- true if an agent running the job is connected
-