[
https://issues.apache.org/jira/browse/CAMEL-8387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14330369#comment-14330369
]
Christoffer Eide commented on CAMEL-8387:
-----------------------------------------
If you don't consider this to be a bug, it would be nice if this was documented
in http://camel.apache.org/file2.html since it's kind of a big 'gotcha'. I'm
not so familiar with the camel project, so I'm not sure on how I can contribute
to the docs..
I don't think a simple check on timeout < interval will quite cut it. If the
two values are close, it's still a good chance that this behavior will be
triggered.
The most obvious way (at least from my POV), would be to change the
{{FileChangedExclusiveReadLockStrategy}}.
from this {{if (delta > timeout)}} to {{if (delta > timeout +
checkInterval)}}. But that may cause other problems..
> File consumer fails to acquire lock if readLockTimeout >=
> readLockCheckInterval
> -------------------------------------------------------------------------------
>
> Key: CAMEL-8387
> URL: https://issues.apache.org/jira/browse/CAMEL-8387
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.14.1
> Reporter: Christoffer Eide
> Priority: Minor
> Fix For: Future
>
>
> If the {{readLockCheckInterval}} is greater than or equal to
> {{readLockTimeout}} when using {{readLock=changed}}, the consumer never picks
> up any files.
> So this URI will triggers the behaviour:
> {{file:some-folder?readLock=changed&readLockCheckInterval=1000&readLockTimeout=500}}
> The problem is that {{FileChangedExclusiveReadLockStrategy}} only takes
> {{readLockTimeout}} into account.
> 1. {{FileChangedExclusiveReadLockStrategy}} get the last modified and size of
> the file.
> 2. It sleeps for the duration configured in {{readLockCheckInterval}}
> 3. Now the timeout configured in {{readLockTimeout}} is exceeded, so
> {{FileChangedExclusiveReadLockStrategy}} logs "Cannot acquire read lock
> within.." and returns false
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)