ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [1/4] ant git commit: serverAliveInterval and serverAliveCountMax in <sshexec> and <scp>
Date Tue, 29 Mar 2016 12:51:47 GMT
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 <bodewig@apache.org>
Authored: Tue Mar 29 14:40:24 2016 +0200
Committer: Stefan Bodewig <bodewig@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;


Mime
View raw message