You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/01/25 08:03:25 UTC

[camel] branch main updated (91b3ac0 -> 0158960)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 91b3ac0  [CAMEL-17546]Introduce camel.failsafe.forkTimeout property for maven-failsafe-plugin
     new d96b4b9  camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.
     new 0158960  camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.

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:
 .../camel/component/file/remote/FtpEndpointConfigurer.java     |  3 ---
 .../camel/component/file/remote/FtpEndpointUriFactory.java     |  3 +--
 .../camel/component/file/remote/FtpsEndpointUriFactory.java    |  3 +--
 .../camel/component/file/remote/SftpEndpointConfigurer.java    |  3 ---
 .../camel/component/file/remote/SftpEndpointUriFactory.java    |  3 +--
 .../resources/org/apache/camel/component/file/remote/ftp.json  |  1 -
 .../resources/org/apache/camel/component/file/remote/ftps.json |  1 -
 .../resources/org/apache/camel/component/file/remote/sftp.json |  1 -
 .../org/apache/camel/component/file/remote/FtpEndpoint.java    |  2 +-
 .../org/apache/camel/component/file/remote/FtpsEndpoint.java   |  2 +-
 .../apache/camel/component/file/remote/RemoteFileEndpoint.java | 10 +++++++++-
 .../org/apache/camel/component/file/remote/SftpEndpoint.java   |  2 +-
 .../org/apache/camel/component/scp/ScpEndpointConfigurer.java  |  3 ---
 .../org/apache/camel/component/scp/ScpEndpointUriFactory.java  |  3 +--
 .../resources/org/apache/camel/component/scp/scp.json          |  1 -
 .../main/java/org/apache/camel/component/scp/ScpEndpoint.java  |  2 +-
 16 files changed, 17 insertions(+), 26 deletions(-)

[camel] 01/02: camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d96b4b974c39b409767fe888b0e851e1710cfc28
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 25 08:54:12 2022 +0100

    camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.
---
 .../camel/component/file/remote/FtpEndpointConfigurer.java     |  3 ---
 .../camel/component/file/remote/FtpEndpointUriFactory.java     |  3 +--
 .../camel/component/file/remote/FtpsEndpointUriFactory.java    |  3 +--
 .../camel/component/file/remote/SftpEndpointConfigurer.java    |  3 ---
 .../camel/component/file/remote/SftpEndpointUriFactory.java    |  3 +--
 .../resources/org/apache/camel/component/file/remote/ftp.json  |  1 -
 .../resources/org/apache/camel/component/file/remote/ftps.json |  1 -
 .../resources/org/apache/camel/component/file/remote/sftp.json |  1 -
 .../org/apache/camel/component/file/remote/FtpEndpoint.java    |  2 +-
 .../org/apache/camel/component/file/remote/FtpsEndpoint.java   |  2 +-
 .../apache/camel/component/file/remote/RemoteFileEndpoint.java | 10 +++++++++-
 .../org/apache/camel/component/file/remote/SftpEndpoint.java   |  2 +-
 12 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointConfigurer.java b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointConfigurer.java
index e9516f77..714f698 100644
--- a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointConfigurer.java
+++ b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointConfigurer.java
@@ -196,7 +196,6 @@ public class FtpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "stepwise": target.getConfiguration().setStepwise(property(camelContext, boolean.class, value)); return true;
         case "streamdownload":
         case "streamDownload": target.getConfiguration().setStreamDownload(property(camelContext, boolean.class, value)); return true;
-        case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
         case "tempfilename":
         case "tempFileName": target.setTempFileName(property(camelContext, java.lang.String.class, value)); return true;
         case "tempprefix":
@@ -399,7 +398,6 @@ public class FtpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "stepwise": return boolean.class;
         case "streamdownload":
         case "streamDownload": return boolean.class;
-        case "synchronous": return boolean.class;
         case "tempfilename":
         case "tempFileName": return java.lang.String.class;
         case "tempprefix":
@@ -603,7 +601,6 @@ public class FtpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "stepwise": return target.getConfiguration().isStepwise();
         case "streamdownload":
         case "streamDownload": return target.getConfiguration().isStreamDownload();
-        case "synchronous": return target.isSynchronous();
         case "tempfilename":
         case "tempFileName": return target.getTempFileName();
         case "tempprefix":
diff --git a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointUriFactory.java b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointUriFactory.java
index 5a58d415..540c8a9 100644
--- a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointUriFactory.java
+++ b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpEndpointUriFactory.java
@@ -21,11 +21,10 @@ public class FtpEndpointUriFactory extends org.apache.camel.support.component.En
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(114);
+        Set<String> props = new HashSet<>(113);
         props.add("disconnect");
         props.add("moveExistingFileStrategy");
         props.add("fileName");
-        props.add("synchronous");
         props.add("idempotent");
         props.add("password");
         props.add("preSort");
diff --git a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpsEndpointUriFactory.java b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpsEndpointUriFactory.java
index b369a9f..e61db34 100644
--- a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpsEndpointUriFactory.java
+++ b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/FtpsEndpointUriFactory.java
@@ -21,11 +21,10 @@ public class FtpsEndpointUriFactory extends org.apache.camel.support.component.E
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(122);
+        Set<String> props = new HashSet<>(121);
         props.add("disconnect");
         props.add("moveExistingFileStrategy");
         props.add("fileName");
-        props.add("synchronous");
         props.add("idempotent");
         props.add("password");
         props.add("preSort");
diff --git a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointConfigurer.java b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointConfigurer.java
index 334c95e..8ac9aba 100644
--- a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointConfigurer.java
+++ b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointConfigurer.java
@@ -224,7 +224,6 @@ public class SftpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "streamDownload": target.getConfiguration().setStreamDownload(property(camelContext, boolean.class, value)); return true;
         case "stricthostkeychecking":
         case "strictHostKeyChecking": target.getConfiguration().setStrictHostKeyChecking(property(camelContext, java.lang.String.class, value)); return true;
-        case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
         case "tempfilename":
         case "tempFileName": target.setTempFileName(property(camelContext, java.lang.String.class, value)); return true;
         case "tempprefix":
@@ -451,7 +450,6 @@ public class SftpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "streamDownload": return boolean.class;
         case "stricthostkeychecking":
         case "strictHostKeyChecking": return java.lang.String.class;
-        case "synchronous": return boolean.class;
         case "tempfilename":
         case "tempFileName": return java.lang.String.class;
         case "tempprefix":
@@ -679,7 +677,6 @@ public class SftpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "streamDownload": return target.getConfiguration().isStreamDownload();
         case "stricthostkeychecking":
         case "strictHostKeyChecking": return target.getConfiguration().getStrictHostKeyChecking();
-        case "synchronous": return target.isSynchronous();
         case "tempfilename":
         case "tempFileName": return target.getTempFileName();
         case "tempprefix":
diff --git a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointUriFactory.java b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointUriFactory.java
index de23d11..86931e5 100644
--- a/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointUriFactory.java
+++ b/components/camel-ftp/src/generated/java/org/apache/camel/component/file/remote/SftpEndpointUriFactory.java
@@ -21,12 +21,11 @@ public class SftpEndpointUriFactory extends org.apache.camel.support.component.E
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(127);
+        Set<String> props = new HashSet<>(126);
         props.add("disconnect");
         props.add("moveExistingFileStrategy");
         props.add("fileName");
         props.add("strictHostKeyChecking");
-        props.add("synchronous");
         props.add("idempotent");
         props.add("password");
         props.add("privateKeyPassphrase");
diff --git a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftp.json b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftp.json
index b1012df..176cf4e 100644
--- a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftp.json
+++ b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftp.json
@@ -91,7 +91,6 @@
     "siteCommand": { "kind": "parameter", "displayName": "Site Command", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.file.remote.FtpConfiguration", "configurationField": "configuration", "description": "Sets optional site command(s) to be executed after successful login. Multiple site commands can be separated using [...]
     "soTimeout": { "kind": "parameter", "displayName": "So Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.file.remote.FtpConfiguration", "configurationField": "configuration", "description": "Sets the so timeout FTP and FTPS Is the SocketOptions.SO_TIMEOUT value in millis. Recommended option is [...]
     "stepwise": { "kind": "parameter", "displayName": "Stepwise", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.file.remote.FtpConfiguration", "configurationField": "configuration", "description": "Sets whether we should stepwise change directories while traversing file structures when downloading files, [...]
-    "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used" },
     "throwExceptionOnConnectFailed": { "kind": "parameter", "displayName": "Throw Exception On Connect Failed", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.file.remote.FtpConfiguration", "configurationField": "configuration", "description": "Should an exception be thrown if connection failed (exhauste [...]
     "timeout": { "kind": "parameter", "displayName": "Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.file.remote.FtpConfiguration", "configurationField": "configuration", "description": "Sets the data timeout for waiting for reply Used only by FTPClient" },
     "antExclude": { "kind": "parameter", "displayName": "Ant Exclude", "group": "filter", "label": "consumer,filter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Ant style filter exclusion. If both antInclude and antExclude are used, antExclude takes precedence over antInclude. Multiple exclusions may be specified in comma-delimited format." },
diff --git a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftps.json b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftps.json
index 6218118..b3d4289 100644
--- a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftps.json
+++ b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/ftps.json
@@ -92,7 +92,6 @@
     "siteCommand": { "kind": "parameter", "displayName": "Site Command", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.file.remote.FtpsConfiguration", "configurationField": "configuration", "description": "Sets optional site command(s) to be executed after successful login. Multiple site commands can be separated usin [...]
     "soTimeout": { "kind": "parameter", "displayName": "So Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.file.remote.FtpsConfiguration", "configurationField": "configuration", "description": "Sets the so timeout FTP and FTPS Is the SocketOptions.SO_TIMEOUT value in millis. Recommended option i [...]
     "stepwise": { "kind": "parameter", "displayName": "Stepwise", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.file.remote.FtpsConfiguration", "configurationField": "configuration", "description": "Sets whether we should stepwise change directories while traversing file structures when downloading files [...]
-    "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used" },
     "throwExceptionOnConnectFailed": { "kind": "parameter", "displayName": "Throw Exception On Connect Failed", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.file.remote.FtpsConfiguration", "configurationField": "configuration", "description": "Should an exception be thrown if connection failed (exhaust [...]
     "timeout": { "kind": "parameter", "displayName": "Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.file.remote.FtpsConfiguration", "configurationField": "configuration", "description": "Sets the data timeout for waiting for reply Used only by FTPClient" },
     "antExclude": { "kind": "parameter", "displayName": "Ant Exclude", "group": "filter", "label": "consumer,filter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Ant style filter exclusion. If both antInclude and antExclude are used, antExclude takes precedence over antInclude. Multiple exclusions may be specified in comma-delimited format." },
diff --git a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/sftp.json b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/sftp.json
index 9a817fc..ef5036d 100644
--- a/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/sftp.json
+++ b/components/camel-ftp/src/generated/resources/org/apache/camel/component/file/remote/sftp.json
@@ -87,7 +87,6 @@
     "serverAliveInterval": { "kind": "parameter", "displayName": "Server Alive Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.file.remote.SftpConfiguration", "configurationField": "configuration", "description": "Sets the interval (millis) to send a keep-alive message. If zero is specified, any keep-alive message must n [...]
     "soTimeout": { "kind": "parameter", "displayName": "So Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.file.remote.SftpConfiguration", "configurationField": "configuration", "description": "Sets the so timeout FTP and FTPS Is the SocketOptions.SO_TIMEOUT value in millis. Recommended option i [...]
     "stepwise": { "kind": "parameter", "displayName": "Stepwise", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.file.remote.SftpConfiguration", "configurationField": "configuration", "description": "Sets whether we should stepwise change directories while traversing file structures when downloading files [...]
-    "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used" },
     "throwExceptionOnConnectFailed": { "kind": "parameter", "displayName": "Throw Exception On Connect Failed", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.file.remote.SftpConfiguration", "configurationField": "configuration", "description": "Should an exception be thrown if connection failed (exhaust [...]
     "timeout": { "kind": "parameter", "displayName": "Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.file.remote.SftpConfiguration", "configurationField": "configuration", "description": "Sets the data timeout for waiting for reply Used only by FTPClient" },
     "antExclude": { "kind": "parameter", "displayName": "Ant Exclude", "group": "filter", "label": "consumer,filter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Ant style filter exclusion. If both antInclude and antExclude are used, antExclude takes precedence over antInclude. Multiple exclusions may be specified in comma-delimited format." },
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
index 2b3191b..58d878e 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
                               + "readLockIdempotentReleaseDelay,readLockIdempotentReleaseExecutorService,"
                               + "directoryMustExist,extendedAttributes,probeContentType,startingDirectoryMustExist,"
                               + "startingDirectoryMustHaveAccess,chmodDirectory,forceWrites,copyAndDeleteOnRenameFail,"
-                              + "renameUsingCopy")
+                              + "renameUsingCopy,synchronous")
 @ManagedResource(description = "Managed FtpEndpoint")
 public class FtpEndpoint<T extends FTPFile> extends RemoteFileEndpoint<FTPFile> {
 
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
index 736ea35..fac83e0 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
                               + "readLockIdempotentReleaseDelay,readLockIdempotentReleaseExecutorService,"
                               + "directoryMustExist,extendedAttributes,probeContentType,startingDirectoryMustExist,"
                               + "startingDirectoryMustHaveAccess,chmodDirectory,forceWrites,copyAndDeleteOnRenameFail,"
-                              + "renameUsingCopy")
+                              + "renameUsingCopy,synchronous")
 @ManagedResource(description = "Managed FtpsEndpoint")
 public class FtpsEndpoint extends FtpEndpoint<FTPFile> {
     private static final Logger LOG = LoggerFactory.getLogger(FtpsEndpoint.class);
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
index 904805d..a8e78d5 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
@@ -68,6 +68,8 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> {
     private boolean download = true;
 
     public RemoteFileEndpoint() {
+        // ftp must be synchronous as the ftp-client is not thread-safe
+        setSynchronous(true);
         // no args constructor for spring bean endpoint configuration
         // for ftp we need to use higher interval/checkout that for files
         setReadLockTimeout(20000);
@@ -80,6 +82,8 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> {
     public RemoteFileEndpoint(String uri, RemoteFileComponent<T> component, RemoteFileConfiguration configuration) {
         super(uri, component);
         this.configuration = configuration;
+        // ftp must be synchronous as the ftp-client is not thread-safe
+        setSynchronous(true);
         // for ftp we need to use higher interval/checkout that for files
         setReadLockTimeout(20000);
         setReadLockCheckInterval(5000);
@@ -180,12 +184,16 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> {
     /**
      * Validates this endpoint if its configured properly.
      *
-     * @throws Exception is thrown if endpoint is invalid configured for its mandatory options
+     * @throws IllegalArgumentException is thrown if endpoint is invalid configured for its mandatory options
      */
     protected void afterPropertiesSet() {
         RemoteFileConfiguration config = getConfiguration();
         StringHelper.notEmpty(config.getHost(), "host");
         StringHelper.notEmpty(config.getProtocol(), "protocol");
+
+        if (!isSynchronous()) {
+            throw new IllegalArgumentException("Using synchronous=false is not supported for camel-ftp");
+        }
     }
 
     @Override
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
index ba1b7b4..5a26d75 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
@@ -35,7 +35,7 @@ import org.apache.camel.spi.UriParam;
 @Metadata(excludeProperties = "appendChars,bufferSize,siteCommand,"
                               + "directoryMustExist,extendedAttributes,probeContentType,startingDirectoryMustExist,"
                               + "startingDirectoryMustHaveAccess,forceWrites,copyAndDeleteOnRenameFail,"
-                              + "renameUsingCopy")
+                              + "renameUsingCopy,synchronous")
 public class SftpEndpoint extends RemoteFileEndpoint<SftpRemoteFile> {
 
     @UriParam

[camel] 02/02: camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0158960a4b65a55f3850e89b6f4b2598ce9a82f0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 25 09:01:27 2022 +0100

    camel-ftp - Force using synchronous due to thread-safety of ftp client used by the consumer.
---
 .../java/org/apache/camel/component/scp/ScpEndpointConfigurer.java     | 3 ---
 .../java/org/apache/camel/component/scp/ScpEndpointUriFactory.java     | 3 +--
 .../src/generated/resources/org/apache/camel/component/scp/scp.json    | 1 -
 .../src/main/java/org/apache/camel/component/scp/ScpEndpoint.java      | 2 +-
 4 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointConfigurer.java b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointConfigurer.java
index b431190..7ded765 100644
--- a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointConfigurer.java
+++ b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointConfigurer.java
@@ -54,7 +54,6 @@ public class ScpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "soTimeout": target.getConfiguration().setSoTimeout(property(camelContext, int.class, value)); return true;
         case "stricthostkeychecking":
         case "strictHostKeyChecking": target.getConfiguration().setStrictHostKeyChecking(property(camelContext, java.lang.String.class, value)); return true;
-        case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
         case "timeout": target.getConfiguration().setTimeout(property(camelContext, int.class, value)); return true;
         case "useuserknownhostsfile":
         case "useUserKnownHostsFile": target.getConfiguration().setUseUserKnownHostsFile(property(camelContext, boolean.class, value)); return true;
@@ -99,7 +98,6 @@ public class ScpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "soTimeout": return int.class;
         case "stricthostkeychecking":
         case "strictHostKeyChecking": return java.lang.String.class;
-        case "synchronous": return boolean.class;
         case "timeout": return int.class;
         case "useuserknownhostsfile":
         case "useUserKnownHostsFile": return boolean.class;
@@ -145,7 +143,6 @@ public class ScpEndpointConfigurer extends PropertyConfigurerSupport implements
         case "soTimeout": return target.getConfiguration().getSoTimeout();
         case "stricthostkeychecking":
         case "strictHostKeyChecking": return target.getConfiguration().getStrictHostKeyChecking();
-        case "synchronous": return target.isSynchronous();
         case "timeout": return target.getConfiguration().getTimeout();
         case "useuserknownhostsfile":
         case "useUserKnownHostsFile": return target.getConfiguration().isUseUserKnownHostsFile();
diff --git a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
index fbdcf26..7e9eb04 100644
--- a/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
+++ b/components/camel-jsch/src/generated/java/org/apache/camel/component/scp/ScpEndpointUriFactory.java
@@ -21,14 +21,13 @@ public class ScpEndpointUriFactory extends org.apache.camel.support.component.En
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(26);
+        Set<String> props = new HashSet<>(25);
         props.add("useUserKnownHostsFile");
         props.add("disconnect");
         props.add("disconnectOnBatchComplete");
         props.add("moveExistingFileStrategy");
         props.add("fileName");
         props.add("strictHostKeyChecking");
-        props.add("synchronous");
         props.add("timeout");
         props.add("flatten");
         props.add("password");
diff --git a/components/camel-jsch/src/generated/resources/org/apache/camel/component/scp/scp.json b/components/camel-jsch/src/generated/resources/org/apache/camel/component/scp/scp.json
index 0b9eea1..ff4c277 100644
--- a/components/camel-jsch/src/generated/resources/org/apache/camel/component/scp/scp.json
+++ b/components/camel-jsch/src/generated/resources/org/apache/camel/component/scp/scp.json
@@ -43,7 +43,6 @@
     "moveExistingFileStrategy": { "kind": "parameter", "displayName": "Move Existing File Strategy", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.file.strategy.FileMoveExistingStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "Strategy (Custom Strategy) used to move file with special naming token to use when fileExist=Move is configured. By default, there is an  [...]
     "connectTimeout": { "kind": "parameter", "displayName": "Connect Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "10000", "configurationClass": "org.apache.camel.component.scp.ScpConfiguration", "configurationField": "configuration", "description": "Sets the connect timeout for waiting for a connection to be established Used by both FTPClient and JSCH" },
     "soTimeout": { "kind": "parameter", "displayName": "So Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "300000", "configurationClass": "org.apache.camel.component.scp.ScpConfiguration", "configurationField": "configuration", "description": "Sets the so timeout FTP and FTPS Is the SocketOptions.SO_TIMEOUT value in millis. Recommended option is to set  [...]
-    "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used" },
     "timeout": { "kind": "parameter", "displayName": "Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "duration", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "30000", "configurationClass": "org.apache.camel.component.scp.ScpConfiguration", "configurationField": "configuration", "description": "Sets the data timeout for waiting for reply Used only by FTPClient" },
     "knownHostsFile": { "kind": "parameter", "displayName": "Known Hosts File", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.scp.ScpConfiguration", "configurationField": "configuration", "description": "Sets the known_hosts file, so that the jsch endpoint can do host key verification. You can prefix with classpath: to [...]
     "password": { "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.scp.ScpConfiguration", "configurationField": "configuration", "description": "Password to use for login" },
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpEndpoint.java b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpEndpoint.java
index f2ff27c..5f97aff 100644
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpEndpoint.java
+++ b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpEndpoint.java
@@ -38,7 +38,7 @@ import org.apache.camel.spi.UriParam;
                               + ",maximumReconnectAttempts,reconnectDelay,autoCreate,bufferSize,siteCommand,stepwise,throwExceptionOnConnectFailed"
                               + ",transferLoggingIntervalSeconds,transferLoggingLevel,transferLoggingVerbose,resumeDownload"
                               + ",handleDirectoryParserAbsoluteResult,activePortRange,ftpClient,ftpClientConfig"
-                              + ",ftpClientConfigParameters,ftpClientParameters,account")
+                              + ",ftpClientConfigParameters,ftpClientParameters,account,synchronous")
 public class ScpEndpoint extends RemoteFileEndpoint<ScpFile> {
 
     @UriParam