hudson
Class TcpSlaveAgentListener

java.lang.Object
  extended by java.lang.Thread
      extended by hudson.TcpSlaveAgentListener
All Implemented Interfaces:
Runnable

public final class TcpSlaveAgentListener
extends Thread

Listens to incoming TCP connections from JNLP slave agents and CLI.

Aside from the HTTP endpoint, Jenkins runs TcpSlaveAgentListener that listens on a TCP socket. Historically this was used for inbound connection from slave 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 AgentProtocols.

Author:
Kohsuke Kawaguchi
See Also:
AgentProtocol

Nested Class Summary
static class TcpSlaveAgentListener.ConnectionFromCurrentPeer
          Connection terminated because we are reconnected from the current peer.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String CLI_HOST_NAME
          Host name that we advertise the CLI client to connect to.
 int configuredPort
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TcpSlaveAgentListener(int port)
           
 
Method Summary
 int getPort()
          Gets the TCP port number in which we are listening.
 void run()
           
 void shutdown()
          Initiates the shuts down of the listener.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

configuredPort

public final int configuredPort

CLI_HOST_NAME

public static String CLI_HOST_NAME
Host name that we advertise the CLI client to connect to. This is primarily for those who have reverse proxies in place such that the HTTP host name and the CLI TCP/IP connection host names are different. TODO: think about how to expose this (including whether this needs to be exposed at all.)

Constructor Detail

TcpSlaveAgentListener

public TcpSlaveAgentListener(int port)
                      throws IOException
Parameters:
port - Use 0 to choose a random port.
Throws:
IOException
Method Detail

getPort

public int getPort()
Gets the TCP port number in which we are listening.


run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

shutdown

public void shutdown()
Initiates the shuts down of the listener.



Copyright © 2004-2013. All Rights Reserved.