Skip to content

Commit

Permalink
[FIXED JENKINS-14803] add options 'noReconnect'
Browse files Browse the repository at this point in the history
  • Loading branch information
kkkon authored and kkkon committed Feb 17, 2013
1 parent 3465c9b commit 7cc8329
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/hudson/remoting/Launcher.java
Expand Up @@ -172,6 +172,12 @@ public boolean verify(String s, SSLSession sslSession) {
});
}

@Option(name="-noReconnectJnlp",usage="Doesn't try to reconnect when fetch JNLP")
public boolean noReconnectJnlp = false;

@Option(name="-noReconnectAgent",usage="Doesn't try to reconnect by JNLP slave agent")
public boolean noReconnectAgent = false;

public static void main(String... args) throws Exception {
Launcher launcher = new Launcher();
CmdLineParser parser = new CmdLineParser(launcher);
Expand Down Expand Up @@ -205,6 +211,10 @@ public void run() throws Exception {
} else
if(slaveJnlpURL!=null) {
List<String> jnlpArgs = parseJnlpArguments();
if ( this.noReconnectAgent )
{
jnlpArgs.add("-noreconnect");
}
try {
hudson.remoting.jnlp.Main._main(jnlpArgs.toArray(new String[jnlpArgs.size()]));
} catch (CmdLineException e) {
Expand Down Expand Up @@ -308,6 +318,10 @@ public List<String> parseJnlpArguments() throws ParserConfigurationException, SA
} catch (IOException e) {
System.err.println("Failing to obtain "+slaveJnlpURL);
e.printStackTrace(System.err);
if ( this.noReconnectJnlp )
{
throw e;
}
System.err.println("Waiting 10 seconds before retry");
Thread.sleep(10*1000);
// retry
Expand Down

0 comments on commit 7cc8329

Please sign in to comment.