camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Cosentino (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9820) SFTP readLock=changed does not work with readLockMinAge option
Date Wed, 06 Apr 2016 09:31:25 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andrea Cosentino updated CAMEL-9820:
------------------------------------
    Fix Version/s: 2.18.0
                   2.17.1
                   2.16.4

> SFTP readLock=changed does not work with readLockMinAge option
> --------------------------------------------------------------
>
>                 Key: CAMEL-9820
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9820
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.16.1
>            Reporter: Harini Vaidhyanathan
>            Assignee: Andrea Cosentino
>             Fix For: 2.16.4, 2.17.1, 2.18.0
>
>
> For the feature I am building, I need to use SFTP to fetch files to process. When it
comes to large files, I want to be able to pick up a file for processing only when its been
completely written. In order to achieve this, I tried the following combination suggesting
the file age should be 10 minutes or more.
> readLock=changed
> readLockMinAge=10m 
> This did not work as expected and kept picking up the files in the next poll as soon
as the write has started. I found the following while debugging.
> In class SftpChangedExclusiveReadLockStrategy,  
> long startTime = (new Date()).getTime();  ==> returns time in milliseconds as long
> newLastModified = f.getAttrs().getMTime();  ==> returns time in seconds as int casted
to long.
> Hence when the following check is made, the comparison becomes to be between newLastModified
which is in seconds and newOlderThan in milliseconds hence never quite honoring the readLockMinAge
specified.
> (minAge != 0 && newLastModified < newOlderThan)
> It looks like there should be 
> newLastModified = f.getAttrs().getMTime() * 1000; 
> to convert this to milliseconds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message