public class AgentRoutingServiceCuratorDiscoveryImpl extends java.lang.Object implements AgentRoutingService
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.| Modifier and Type | Class and Description |
|---|---|
static class |
AgentRoutingServiceCuratorDiscoveryImpl.Agent
Payload for typed
ServiceDiscovery. |
| Constructor and Description |
|---|
AgentRoutingServiceCuratorDiscoveryImpl(com.netflix.genie.common.internal.util.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.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<java.lang.String> |
getHostnameForAgentConnection(@NotBlank java.lang.String jobId)
Look up the hostname of the Genie node currently handling the agent connection for a given job.
|
void |
handleClientConnected(@NotBlank java.lang.String jobId)
Handle a new agent connection.
|
void |
handleClientDisconnected(@NotBlank java.lang.String jobId)
Handle connected agent disconnection.
|
boolean |
isAgentConnected(java.lang.String jobId)
Whether the agent executing a given job is currently connected.
|
boolean |
isAgentConnectionLocal(@NotBlank java.lang.String jobId)
Tells wether the agent running a given job is connected to the local node.
|
public AgentRoutingServiceCuratorDiscoveryImpl(com.netflix.genie.common.internal.util.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)
genieHostInfo - The genie local host informationserviceDiscovery - The service discovery clienttaskScheduler - The task schedulerlistenableCuratorConnectionState - The listenable curator client connection statusregistry - The metrics registryproperties - The service propertiespublic void handleClientConnected(@NotBlank
@NotBlank java.lang.String jobId)
AgentRoutingServicehandleClientConnected in interface AgentRoutingServicejobId - the job id the connected agent is runningpublic void handleClientDisconnected(@NotBlank
@NotBlank java.lang.String jobId)
AgentRoutingServicehandleClientDisconnected in interface AgentRoutingServicejobId - the job id the disconnected agent is runningpublic java.util.Optional<java.lang.String> getHostnameForAgentConnection(@NotBlank
@NotBlank java.lang.String jobId)
getHostnameForAgentConnection in interface AgentRoutingServicejobId - the job idpublic boolean isAgentConnectionLocal(@NotBlank
@NotBlank java.lang.String jobId)
isAgentConnectionLocal in interface AgentRoutingServicejobId - the job idpublic boolean isAgentConnected(java.lang.String jobId)
isAgentConnected in interface AgentRoutingServicejobId - the job id