Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-44103] - Cleanup usages of the "JNLP" term in TcpSlaveAgentL…
…istener

(cherry picked from commit b5fe89c)
  • Loading branch information
oleg-nenashev authored and olivergondza committed Jul 20, 2017
1 parent c2163c5 commit c2c6306
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions core/src/main/java/hudson/TcpSlaveAgentListener.java
Expand Up @@ -23,6 +23,7 @@
*/
package hudson;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.ByteArrayInputStream;
import java.io.SequenceInputStream;
import java.io.Writer;
Expand Down Expand Up @@ -57,9 +58,11 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

/**
* Listens to incoming TCP connections from JNLP agents and CLI.
* Listens to incoming TCP connections from JNLP agents and Remoting CLI.
*
* <p>
* Aside from the HTTP endpoint, Jenkins runs {@link TcpSlaveAgentListener} that listens on a TCP socket.
Expand Down Expand Up @@ -95,7 +98,7 @@ public TcpSlaveAgentListener(int port) throws IOException {
}
this.configuredPort = port;

LOGGER.log(Level.FINE, "JNLP agent listener started on TCP port {0}", getPort());
LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort());

start();
}
Expand Down Expand Up @@ -155,7 +158,7 @@ public void run() {
}
} catch (IOException e) {
if(!shuttingDown) {
LOGGER.log(Level.SEVERE,"Failed to accept JNLP agent connections",e);
LOGGER.log(Level.SEVERE,"Failed to accept TCP connections", e);
}
}
}
Expand Down Expand Up @@ -241,14 +244,14 @@ public void run() {
LOGGER.log(Level.WARNING,"Connection #"+id+" aborted",e);
try {
s.close();
} catch (IOException _) {
} catch (IOException ex) {
// try to clean up the socket
}
} catch (IOException e) {
LOGGER.log(Level.WARNING,"Connection #"+id+" failed",e);
try {
s.close();
} catch (IOException _) {
} catch (IOException ex) {
// try to clean up the socket
}
}
Expand Down Expand Up @@ -292,7 +295,7 @@ private void respondHello(String header, Socket s) throws IOException {

private void error(PrintWriter out, String msg) throws IOException {
out.println(msg);
LOGGER.log(Level.WARNING,"Connection #"+id+" is aborted: "+msg);
LOGGER.log(Level.WARNING, "Connection #{0} is aborted: {1}", new Object[]{id, msg});
s.close();
}
}
Expand Down Expand Up @@ -398,6 +401,8 @@ public String toString() {
*
* TODO: think about how to expose this (including whether this needs to be exposed at all.)
*/
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Accessible via System Groovy Scripts")
@Restricted(NoExternalUse.class)
public static String CLI_HOST_NAME = SystemProperties.getString(TcpSlaveAgentListener.class.getName()+".hostName");

/**
Expand All @@ -410,6 +415,8 @@ public String toString() {
*
* @since 1.611
*/
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Accessible via System Groovy Scripts")
@Restricted(NoExternalUse.class)
public static Integer CLI_PORT = SystemProperties.getInteger(TcpSlaveAgentListener.class.getName()+".port");
}

Expand Down
Expand Up @@ -26,7 +26,7 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" trim="true">
<st:contentType value="text/plain;charset=UTF-8"/>
<!--
Publicize the TCP port number for JNLP agents so that they know where to connect.
Publicize the TCP port number for TCP agents and Remoting CLI so that they know where to connect.
Keep the legacy header for better backward compatibility
-->
<st:header name="X-Hudson-JNLP-Port" value="${app.tcpSlaveAgentListener.advertisedPort}" />
Expand Down

0 comments on commit c2c6306

Please sign in to comment.