You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/03/29 14:51:47 UTC

[1/4] ant git commit: serverAliveInterval and serverAliveCountMax in and

Repository: ant
Updated Branches:
  refs/heads/master d1736c7bb -> 5024dcf97


serverAliveInterval and serverAliveCountMax in <sshexec> and <scp>

Patch by Issa Gorissen

https://bz.apache.org/bugzilla/show_bug.cgi?id=59162


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/851aa5fb
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/851aa5fb
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/851aa5fb

Branch: refs/heads/master
Commit: 851aa5fb5682c689ec8864942003af70113e3c7c
Parents: 17527b6
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Mar 29 14:40:24 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Mar 29 14:41:30 2016 +0200

----------------------------------------------------------------------
 CONTRIBUTORS                                    |  1 +
 WHATSNEW                                        |  5 +++
 contributors.xml                                |  4 ++
 .../ant/taskdefs/optional/ssh/SSHBase.java      | 44 ++++++++++++++++++++
 4 files changed, 54 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/851aa5fb/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index af1a509..74d6c63 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -154,6 +154,7 @@ Ingenonsya France
 Ingmar Stein
 Irene Rusman
 Isaac Shabtay
+Issa Gorissen
 Ivan Ivanov
 J Bleijenbergh
 Jack J. Woehr

http://git-wip-us.apache.org/repos/asf/ant/blob/851aa5fb/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index a0c575d..a2dd3d5 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -80,6 +80,11 @@ Other changes:
  * <javac> now supports Java9 modules.
    https://github.com/apache/ant/pull/16
 
+ * <sshexec> and <scp> have two new attributes serverAliveInterval and
+   serverAliveCountMax that can be used to keep a intermediaries from
+   closing idle connections.
+   Bugzilla Report 59162
+
 Changes from Ant 1.9.5 TO Ant 1.9.6
 ===================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/851aa5fb/contributors.xml
----------------------------------------------------------------------
diff --git a/contributors.xml b/contributors.xml
index 4029a0d..85066b7 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -641,6 +641,10 @@
     <last>Shabtay</last>
   </name>
   <name>
+    <first>Issa</first>
+    <last>Gorissen</last>
+  </name>
+  <name>
     <first>Ivan</first>
     <last>Ivanov</last>
   </name>

http://git-wip-us.apache.org/repos/asf/ant/blob/851aa5fb/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
index 68419a8..df7996a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
@@ -42,6 +42,8 @@ public abstract class SSHBase extends Task implements LogListener {
     private boolean failOnError = true;
     private boolean verbose;
     private final SSHUserInfo userInfo;
+    private int serverAliveCountMax = 3;
+    private int serverAliveIntervalSeconds = 0;
 
     /**
      * Constructor for SSHBase.
@@ -105,6 +107,42 @@ public abstract class SSHBase extends Task implements LogListener {
     }
 
     /**
+     * Set the serverAliveCountMax value.
+     * @since Ant 1.9.7
+     */
+    public void setServerAliveCountMax(final int countMax) {
+        if (countMax <= 0) throw new IllegalArgumentException("ssh server alive count max setting cannot be negative or zero");
+        this.serverAliveCountMax = countMax;
+    }
+
+    /**
+     * Get the serverAliveCountMax value.
+     * @return the serverAliveCountMax value
+     * @since Ant 1.9.7
+     */
+    public int getServerAliveCountMax() {
+        return serverAliveCountMax;
+    }
+
+    /**
+     * Set the serverAliveIntervalSeconds value in seconds.
+     * @since Ant 1.9.7
+     */
+    public void setServerAliveIntervalSeconds(final int interval) {
+        if (interval < 0) throw new IllegalArgumentException("ssh server alive interval setting cannot be negative");
+        this.serverAliveIntervalSeconds = interval;
+    }
+
+    /**
+     * Get the serverAliveIntervalSeconds value in seconds.
+     * @return the serverAliveIntervalSeconds value in seconds
+     * @since Ant 1.9.7
+     */
+    public int getServerAliveIntervalSeconds() {
+        return serverAliveIntervalSeconds;
+    }
+
+    /**
      * Username known to remote host.
      *
      * @param username  The new username value
@@ -221,6 +259,12 @@ public abstract class SSHBase extends Task implements LogListener {
         session.setConfig("PreferredAuthentications",
                 "publickey,keyboard-interactive,password");
         session.setUserInfo(userInfo);
+
+        if (serverAliveIntervalSeconds > 0) {
+            session.setServerAliveCountMax(serverAliveCountMax);
+            session.setServerAliveInterval(serverAliveIntervalSeconds * 1000);
+        }
+
         log("Connecting to " + host + ":" + port);
         session.connect();
         return session;


[2/4] ant git commit: cosmetics

Posted by bo...@apache.org.
cosmetics


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/edeb171a
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/edeb171a
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/edeb171a

Branch: refs/heads/master
Commit: edeb171a781501ed906b2d2bdd38e22b3fe81e02
Parents: 851aa5f
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Mar 29 14:43:06 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Mar 29 14:43:06 2016 +0200

----------------------------------------------------------------------
 .../tools/ant/taskdefs/optional/ssh/SSHBase.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/edeb171a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
index df7996a..d6abb95 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
@@ -111,7 +111,9 @@ public abstract class SSHBase extends Task implements LogListener {
      * @since Ant 1.9.7
      */
     public void setServerAliveCountMax(final int countMax) {
-        if (countMax <= 0) throw new IllegalArgumentException("ssh server alive count max setting cannot be negative or zero");
+        if (countMax <= 0) {
+            throw new BuildException("ssh server alive count max setting cannot be negative or zero");
+        }
         this.serverAliveCountMax = countMax;
     }
 
@@ -129,7 +131,9 @@ public abstract class SSHBase extends Task implements LogListener {
      * @since Ant 1.9.7
      */
     public void setServerAliveIntervalSeconds(final int interval) {
-        if (interval < 0) throw new IllegalArgumentException("ssh server alive interval setting cannot be negative");
+        if (interval < 0) {
+            throw new BuildException("ssh server alive interval setting cannot be negative");
+        }
         this.serverAliveIntervalSeconds = interval;
     }
 
@@ -260,9 +264,9 @@ public abstract class SSHBase extends Task implements LogListener {
                 "publickey,keyboard-interactive,password");
         session.setUserInfo(userInfo);
 
-        if (serverAliveIntervalSeconds > 0) {
-            session.setServerAliveCountMax(serverAliveCountMax);
-            session.setServerAliveInterval(serverAliveIntervalSeconds * 1000);
+        if (getServerAliveIntervalSeconds() > 0) {
+            session.setServerAliveCountMax(getServerAliveCountMax());
+            session.setServerAliveInterval(getServerAliveIntervalSeconds() * 1000);
         }
 
         log("Connecting to " + host + ":" + port);


[4/4] ant git commit: Merge branch '1.9.x'

Posted by bo...@apache.org.
Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/5024dcf9
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/5024dcf9
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/5024dcf9

Branch: refs/heads/master
Commit: 5024dcf97bdad134de3eba5f8134f7223082ba5e
Parents: d1736c7 356972a
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Mar 29 14:51:27 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Mar 29 14:51:27 2016 +0200

----------------------------------------------------------------------
 CONTRIBUTORS                                    |  1 +
 WHATSNEW                                        |  5 ++
 contributors.xml                                |  4 ++
 manual/Tasks/scp.html                           | 17 +++++++
 manual/Tasks/sshexec.html                       | 17 +++++++
 .../ant/taskdefs/optional/ssh/SSHBase.java      | 48 ++++++++++++++++++++
 6 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/5024dcf9/WHATSNEW
----------------------------------------------------------------------


[3/4] ant git commit: document serverAliveInterval and serverAliveCountMax

Posted by bo...@apache.org.
document serverAliveInterval and serverAliveCountMax


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/356972ab
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/356972ab
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/356972ab

Branch: refs/heads/master
Commit: 356972ab3a5e0e867a2a90ece8f7e401ac145426
Parents: edeb171
Author: Stefan Bodewig <bo...@apache.org>
Authored: Tue Mar 29 14:48:39 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Tue Mar 29 14:48:39 2016 +0200

----------------------------------------------------------------------
 manual/Tasks/scp.html     | 17 +++++++++++++++++
 manual/Tasks/sshexec.html | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/356972ab/manual/Tasks/scp.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/scp.html b/manual/Tasks/scp.html
index 6d06bd2..909084e 100644
--- a/manual/Tasks/scp.html
+++ b/manual/Tasks/scp.html
@@ -200,6 +200,23 @@ for more information.  This task has been tested with jsch-0.1.2 and later.</p>
       remote server. Default is 755. <em>since Ant 1.9.5</em>.</td>
     <td align="center" valign="top">No</td>
   </tr>
+  <tr>
+    <td valign="top">serverAliveIntervalSeconds</td>
+    <td valign="top">Sets a timeout interval in seconds after which if no data has
+      been received from the server, the task will send a message through
+      the encrypted channel to request a response from the server.
+      <em>since Ant 1.9.7</em></td>
+    <td align="center" valign="top">No, the default is 0, indicating
+      that these messages will not be sent to the server</td>
+  </tr>
+  <tr>
+    <td valign="top">serverAliveCountMax</td>
+    <td valign="top">The number of server alive messages which may be
+      sent without receiving any messages back from the server. Only
+      used if serverAliveIntervalSeconds is not 0.
+      <em>since Ant 1.9.7</em></td>
+    <td align="center" valign="top">No, defaults to 3</td>
+  </tr>
 </table>
 <h3>Parameters specified as nested elements</h3>
 

http://git-wip-us.apache.org/repos/asf/ant/blob/356972ab/manual/Tasks/sshexec.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/sshexec.html b/manual/Tasks/sshexec.html
index 2aab2a6..d085abd 100644
--- a/manual/Tasks/sshexec.html
+++ b/manual/Tasks/sshexec.html
@@ -230,6 +230,23 @@ and won't work with versions of jsch earlier than
       <em>since Ant 1.9.4</em></td>
     <td align="center" valign="top">No, defaults to false</td>
   </tr>
+  <tr>
+    <td valign="top">serverAliveIntervalSeconds</td>
+    <td valign="top">Sets a timeout interval in seconds after which if no data has
+      been received from the server, the task will send a message through
+      the encrypted channel to request a response from the server.
+      <em>since Ant 1.9.7</em></td>
+    <td align="center" valign="top">No, the default is 0, indicating
+      that these messages will not be sent to the server</td>
+  </tr>
+  <tr>
+    <td valign="top">serverAliveCountMax</td>
+    <td valign="top">The number of server alive messages which may be
+      sent without receiving any messages back from the server. Only
+      used if serverAliveIntervalSeconds is not 0.
+      <em>since Ant 1.9.7</em></td>
+    <td align="center" valign="top">No, defaults to 3</td>
+  </tr>
 </table>
 
 <h3>Examples</h3>