Class AgentRoutingServiceSingleNodeImpl

java.lang.Object
com.netflix.genie.web.agent.services.impl.AgentRoutingServiceSingleNodeImpl
All Implemented Interfaces:
AgentRoutingService

@Validated public class AgentRoutingServiceSingleNodeImpl extends Object implements AgentRoutingService
Implementation of AgentRoutingService that assumes a single Genie node and tracks connections in-memory.
Since:
4.0.0
  • Constructor Details

    • AgentRoutingServiceSingleNodeImpl

      public AgentRoutingServiceSingleNodeImpl(GenieHostInfo genieHostInfo)
      Constructor.
      Parameters:
      genieHostInfo - local genie node host information
  • Method Details

    • getHostnameForAgentConnection

      public Optional<String> getHostnameForAgentConnection(@NotBlank @NotBlank String jobId)
      Look up the hostname of the Genie node currently handling the agent connection for a given job.
      Specified by:
      getHostnameForAgentConnection in interface AgentRoutingService
      Parameters:
      jobId - the job id
      Returns:
      a boxed hostname string, empty if the connection for the given job id is not found
    • isAgentConnectionLocal

      public boolean isAgentConnectionLocal(@NotBlank @NotBlank String jobId)
      Tells whether the agent running a given job is connected to the local node.
      Specified by:
      isAgentConnectionLocal in interface AgentRoutingService
      Parameters:
      jobId - the job id
      Returns:
      true if the agent has an active connection to this node
    • handleClientConnected

      public void handleClientConnected(@NotBlank @NotBlank String jobId)
      Handle a new agent connection.
      Specified by:
      handleClientConnected in interface AgentRoutingService
      Parameters:
      jobId - the job id the connected agent is running
    • handleClientDisconnected

      public void handleClientDisconnected(@NotBlank @NotBlank String jobId)
      Handle connected agent disconnection.
      Specified by:
      handleClientDisconnected in interface AgentRoutingService
      Parameters:
      jobId - the job id the disconnected agent is running
    • isAgentConnected

      public boolean isAgentConnected(String jobId)
      Whether the agent executing a given job is currently connected.
      Specified by:
      isAgentConnected in interface AgentRoutingService
      Parameters:
      jobId - the job id
      Returns:
      true if an agent running the job is connected