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 2019/07/02 12:05:33 UTC
[camel] branch master updated: CAMEL-13680: File component with
readLock=fileLock is not supported on Windows
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 0e9d77d CAMEL-13680: File component with readLock=fileLock is not supported on Windows
0e9d77d is described below
commit 0e9d77dda002b7a7a597d7b1c06eb1ed96a443f6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jul 2 14:05:15 2019 +0200
CAMEL-13680: File component with readLock=fileLock is not supported on Windows
---
components/camel-file/src/main/docs/file-component.adoc | 2 +-
.../org/apache/camel/component/file/GenericFileEndpoint.java | 5 ++++-
.../builder/endpoint/dsl/FileEndpointBuilderFactory.java | 12 ++++++------
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/components/camel-file/src/main/docs/file-component.adoc b/components/camel-file/src/main/docs/file-component.adoc
index 0d39623..54ba798 100644
--- a/components/camel-file/src/main/docs/file-component.adoc
+++ b/components/camel-file/src/main/docs/file-component.adoc
@@ -151,7 +151,7 @@ with the following path and query parameters:
| *minDepth* (filter) | The minimum depth to start processing when recursively processing a directory. Using minDepth=1 means the base directory. Using minDepth=2 means the first sub directory. | | int
| *move* (filter) | Expression (such as Simple Language) used to dynamically set the filename when moving it after processing. To move files into a .done subdirectory just enter .done. | | String
| *exclusiveReadLockStrategy* (lock) | Pluggable read-lock as a org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy implementation. | | GenericFileExclusive ReadLockStrategy
-| *readLock* (lock) | Used by consumer, to only poll the files if it has exclusive read-lock on the file (i.e. the file is not in-progress or being written). Camel will wait until the file lock is granted. This option provides the build in strategies: none - No read lock is in use markerFile - Camel creates a marker file (fileName.camelLock) and then holds a lock on it. This option is not available for the FTP component changed - Changed is using file length/modification timestamp to det [...]
+| *readLock* (lock) | Used by consumer, to only poll the files if it has exclusive read-lock on the file (i.e. the file is not in-progress or being written). Camel will wait until the file lock is granted. This option provides the build in strategies: none - No read lock is in use markerFile - Camel creates a marker file (fileName.camelLock) and then holds a lock on it. This option is not available for the FTP component changed - Changed is using file length/modification timestamp to det [...]
| *readLockCheckInterval* (lock) | Interval in millis for the read-lock, if supported by the read lock. This interval is used for sleeping between attempts to acquire the read lock. For example when using the changed read lock, you can set a higher interval period to cater for slow writes. The default of 1 sec. may be too fast if the producer is very slow writing the file. Notice: For FTP the default readLockCheckInterval is 5000. The readLockTimeout value must be higher than readLockChe [...]
| *readLockDeleteOrphanLock Files* (lock) | Whether or not read lock with marker files should upon startup delete any orphan read lock files, which may have been left on the file system, if Camel was not properly shutdown (such as a JVM crash). If turning this option to false then any orphaned lock file will cause Camel to not attempt to pickup that file, this could also be due another node is concurrently reading files from the same shared directory. | true | boolean
| *readLockIdempotentRelease Async* (lock) | Whether the delayed release task should be synchronous or asynchronous. See more details at the readLockIdempotentReleaseDelay option. | false | boolean
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index ed2b8c9..80a71e3 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -839,7 +839,7 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
* <li>changed - Changed is using file length/modification timestamp to detect whether the file is currently being copied or not. Will at least use 1 sec
* to determine this, so this option cannot consume files as fast as the others, but can be more reliable as the JDK IO API cannot
* always determine whether a file is currently being used by another process. The option readLockCheckInterval can be used to set the check frequency.</li>
- * <li>fileLock - is for using java.nio.channels.FileLock. This option is not avail for the FTP component. This approach should be avoided when accessing
+ * <li>fileLock - is for using java.nio.channels.FileLock. This option is not avail for Windows OS and the FTP component. This approach should be avoided when accessing
* a remote file system via a mount/share unless that file system supports distributed file locks.</li>
* <li>rename - rename is for using a try to rename the file as a test if we can get exclusive read-lock.</li>
* <li>idempotent - (only for file component) idempotent is for using a idempotentRepository as the read-lock.
@@ -1482,6 +1482,9 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
if ("idempotent".equals(readLock) && idempotentRepository == null) {
throw new IllegalArgumentException("IdempotentRepository must be configured when using readLock=idempotent");
}
+ if ("fileLock".equals(readLock) && FileUtil.isWindows()) {
+ throw new IllegalArgumentException("The readLock=fileLock option is not supported on Windows");
+ }
if (antInclude != null) {
if (antFilter == null) {
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
index 0bc2857..ec025c4 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
@@ -733,12 +733,12 @@ public interface FileEndpointBuilderFactory {
* JDK IO API cannot always determine whether a file is currently being
* used by another process. The option readLockCheckInterval can be used
* to set the check frequency. fileLock - is for using
- * java.nio.channels.FileLock. This option is not avail for the FTP
- * component. This approach should be avoided when accessing a remote
- * file system via a mount/share unless that file system supports
- * distributed file locks. rename - rename is for using a try to rename
- * the file as a test if we can get exclusive read-lock. idempotent -
- * (only for file component) idempotent is for using a
+ * java.nio.channels.FileLock. This option is not avail for Windows OS
+ * and the FTP component. This approach should be avoided when accessing
+ * a remote file system via a mount/share unless that file system
+ * supports distributed file locks. rename - rename is for using a try
+ * to rename the file as a test if we can get exclusive read-lock.
+ * idempotent - (only for file component) idempotent is for using a
* idempotentRepository as the read-lock. This allows to use read locks
* that supports clustering if the idempotent repository implementation
* supports that. idempotent-changed - (only for file component)