Package hudson
Class TcpSlaveAgentListener
java.lang.Object
java.lang.Thread
hudson.TcpSlaveAgentListener
- All Implemented Interfaces:
Runnable
Listens to incoming TCP connections, for example from agents.
Aside from the HTTP endpoint, Jenkins runs TcpSlaveAgentListener
that listens on a TCP socket.
Historically this was used for inbound connection from agents (hence the name), but over time
it was extended and made generic, so that multiple protocols of different purposes can co-exist on the
same socket.
This class accepts the socket, then after a short handshaking, it dispatches to appropriate
AgentProtocol
s.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Connection terminated because we are reconnected from the current peer.static class
This extension provides a Ping protocol that allows people to verify that theTcpSlaveAgentListener
is alive.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Host name that we advertise protocol clients to connect to.static Integer
Port number that we advertise protocol clients to connect to.final int
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the host name that we advertise protocol clients to connect to.int
Gets the TCP port number in which we are advertising.Returns a comma separated list of the enabledAgentProtocol.getName()
implementations so that clients can avoid creating additional work for the server attempting to connect with unsupported protocols.Gets the Base64 encoded public key that forms part of this instance's identity keypair.int
getPort()
Gets the TCP port number in which we are listening.Gets Remoting minimum supported version to prevent unsupported agents from connectingvoid
run()
void
shutdown()
Initiates the shuts down of the listener.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
configuredPort
public final int configuredPort -
CLI_HOST_NAME
Host name that we advertise protocol clients to connect to. This is primarily for those who have reverse proxies in place such that the HTTP host name and the TCP/IP connection host names are different. (Note: despite the name, this is used for any client, not only deprecated Remoting-based CLI.) TODO: think about how to expose this (including whether this needs to be exposed at all.) -
CLI_PORT
Port number that we advertise protocol clients to connect to. This is primarily for the case where the port that Jenkins runs is different from the port that external world should connect to, because of the presence of NAT / port-forwarding / TCP reverse proxy. (Note: despite the name, this is used for any client, not only deprecated Remoting-based CLI.) If left to null, fall back togetPort()
- Since:
- 1.611
-
-
Constructor Details
-
TcpSlaveAgentListener
- Parameters:
port
- Use 0 to choose a random port.- Throws:
IOException
-
-
Method Details
-
getPort
public int getPort()Gets the TCP port number in which we are listening. -
getAdvertisedPort
public int getAdvertisedPort()Gets the TCP port number in which we are advertising.- Since:
- 1.656
-
getAdvertisedHost
Gets the host name that we advertise protocol clients to connect to.- Since:
- 2.198
-
getIdentityPublicKey
Gets the Base64 encoded public key that forms part of this instance's identity keypair.- Returns:
- the Base64 encoded public key
- Since:
- 2.16
-
getAgentProtocolNames
Returns a comma separated list of the enabledAgentProtocol.getName()
implementations so that clients can avoid creating additional work for the server attempting to connect with unsupported protocols.- Returns:
- a comma separated list of the enabled
AgentProtocol.getName()
implementations - Since:
- 2.16
-
getRemotingMinimumVersion
Gets Remoting minimum supported version to prevent unsupported agents from connecting- Since:
- 2.171
-
run
public void run() -
shutdown
public void shutdown()Initiates the shuts down of the listener.
-