You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jk...@apache.org on 2019/07/12 15:01:10 UTC
[ant] branch master updated (1702b68 -> 4ea4918)
This is an automated email from the ASF dual-hosted git repository.
jkf pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git.
from 1702b68 Add Ftp ant task timeout documentation also updated
new b719dcf Bugzilla 63252 FTP prevent No Transfer Timeout during long listings by Eugene Adell
new 4ea4918 Add Ftp ant task wakeUpTransferInterval documentation also updated
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
manual/Tasks/ftp.html | 7 ++++
.../tools/ant/taskdefs/optional/net/FTP.java | 48 ++++++++++++++++++++++
2 files changed, 55 insertions(+)
[ant] 02/02: Add Ftp ant task wakeUpTransferInterval documentation
also updated
Posted by jk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jkf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
commit 4ea4918b7097a4d222f122a98d906607e5b07e21
Author: jkf <jm...@famkruithof.net>
AuthorDate: Fri Jul 12 17:00:44 2019 +0200
Add Ftp ant task wakeUpTransferInterval documentation also updated
---
manual/Tasks/ftp.html | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/manual/Tasks/ftp.html b/manual/Tasks/ftp.html
index dad5ad9..758bf83 100644
--- a/manual/Tasks/ftp.html
+++ b/manual/Tasks/ftp.html
@@ -226,6 +226,13 @@ connection.</p>
<td>No</td>
</tr>
<tr>
+ <td>wakeUpTransferInterval</td>
+ <td>Only use if proved to be necessary, interval in seconds on which a LIST command is triggered
+ trigger a data connection (to avoid timeouts by the ftp server on no data connection).
+ <em>since Ant 1.10.7</em></td>
+ <td>No</td>
+ </tr>
+ <tr>
<td colspan="3" class="left">
<p><strong>The following attributes
require <a href="https://commons.apache.org/net/download_net.cgi"
[ant] 01/02: Bugzilla 63252 FTP prevent No Transfer Timeout during
long listings by Eugene Adell
Posted by jk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jkf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
commit b719dcff3d6cd3e79705dcbcb9357579ae8ff711
Author: jkf <jm...@famkruithof.net>
AuthorDate: Fri Jul 12 16:24:54 2019 +0200
Bugzilla 63252 FTP prevent No Transfer Timeout during long listings by Eugene Adell
---
.../tools/ant/taskdefs/optional/net/FTP.java | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index ad16f41..33d27ec 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -146,6 +146,9 @@ public class FTP extends Task implements FTPTaskConfig {
private String initialSiteCommand = null;
private boolean enableRemoteVerification = true;
private int dataTimeout = -1;
+ private int wakeUpTransferInterval = -1;
+ private long lastWakeUpTime = 0;
+
protected static final String[] ACTION_STRS = { //NOSONAR
"sending",
@@ -547,6 +550,14 @@ public class FTP extends Task implements FTPTaskConfig {
}
}
}
+ if(wakeUpTransferInterval > 0) {
+ if(wakeUpTransferIntervalExpired()) {
+ getProject().log("wakeUpTransferInterval is reached, trigger a data connection " , Project.MSG_DEBUG);
+ // send a minimalist command to trigger a data connection
+ ftp.listFiles(file.getName());
+ }
+ }
+
}
ftp.changeToParentDirectory();
} catch (FTPConnectionClosedException ftpcce) {
@@ -1711,6 +1722,21 @@ public class FTP extends Task implements FTPTaskConfig {
}
/**
+ * Sets the time interval when we should automatically
+ * call a command triggering a transfer
+ * The parameter is in seconds
+ *
+ * @param wakeUpTransferInterval int
+ * @since Ant 1.10.6
+ */
+ public void setWakeUpTransferInterval(int wakeUpTransferInterval) {
+ if(wakeUpTransferInterval > 0) {
+ this.wakeUpTransferInterval = wakeUpTransferInterval;
+ }
+ }
+
+
+ /**
* Checks to see that all required parameters are set.
*
* @throws BuildException if the configuration is not valid.
@@ -2438,6 +2464,28 @@ public class FTP extends Task implements FTPTaskConfig {
}
/**
+ * checks if the wake up interval is expired
+ */
+ private boolean wakeUpTransferIntervalExpired() {
+ boolean result = false;
+
+ // on the first call, initialize the keep-alive mechanism
+ // by storing the current date
+ if(lastWakeUpTime == 0) {
+ lastWakeUpTime = (new Date()).getTime();
+ }
+ else {
+ long currentTime = (new Date()).getTime();
+ if(currentTime > (lastWakeUpTime + wakeUpTransferInterval*1000)) {
+ lastWakeUpTime = currentTime;
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ /**
* Runs the task.
*
* @throws BuildException if the task fails or is not configured