CAMEL-8387: File endpoint should validate the read lock timeout/interval options is configured correctly.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/686bb356 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/686bb356 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/686bb356 Branch: refs/heads/master Commit: 686bb35674f8ac19d71f03cf2786f60f52bfb913 Parents: 56db9c0 Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Feb 22 15:55:49 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Feb 22 15:55:49 2015 +0100 ---------------------------------------------------------------------- .../camel/component/file/GenericFileEndpoint.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/686bb356/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java index e2aa419..7cc8cd2 100644 --- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java @@ -817,7 +817,12 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple * 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. - * For FTP the default readLockCheckInterval is 5000. + * <p/> + * Notice: For FTP the default readLockCheckInterval is 5000. + * <p/> + * The readLockTimeout value must be higher than readLockCheckInterval, but a rule of thumb is to have a timeout + * that is at least 2 or more times higher than the readLockCheckInterval. This is needed to ensure that amble + * time is allowed for the read lock process to try to grab the lock before the timeout was hit. */ public void setReadLockCheckInterval(long readLockCheckInterval) { this.readLockCheckInterval = readLockCheckInterval; @@ -832,7 +837,12 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple * If the read-lock could not be granted and the timeout triggered, then Camel will skip the file. * At next poll Camel, will try the file again, and this time maybe the read-lock could be granted. * Use a value of 0 or lower to indicate forever. Currently fileLock, changed and rename support the timeout. + * <p/> * Notice: For FTP the default readLockTimeout value is 20000 instead of 10000. + * <p/> + * The readLockTimeout value must be higher than readLockCheckInterval, but a rule of thumb is to have a timeout + * that is at least 2 or more times higher than the readLockCheckInterval. This is needed to ensure that amble + * time is allowed for the read lock process to try to grab the lock before the timeout was hit. */ public void setReadLockTimeout(long readLockTimeout) { this.readLockTimeout = readLockTimeout;