JIRA j...@apache.org wrote:
> 
> 
> Hi Joe
> 
> I assume its the *trunk* you try? As 2.0m1 is 2 months old.
> 
> Could you try different combinations of the *readLock* on the file
> endpoint.
> See this wiki page for possible values:
> http://camel.apache.org/file2.html
> 
> And also try with *noop=true* instead of *move=endDirectory* to avoid the
> last move operation.
> 
> All in all to help pin point where Windows have a problem with lock files.
> 
> And could you paste the stacktrace.
> 
>> thread() and File Components
>> ----------------------------
>>
>>                 Key: CAMEL-1670
>>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1670
>>             Project: Apache Camel
>>          Issue Type: Bug
>>          Components: camel-core
>>    Affects Versions: 2.0-M1
>>         Environment: Microsoft Windows XP
>>            Reporter: Joe Gottman
>>
>> I just experimented with adding calls to thread(10) to my route to make
>> it multithreaded.  This definitely speeds up by route, but it keeps
>> throwing java.nio.channels.OverlappingFileLockException  errors and
>> leaving lock files behind it.  The start of my route looks like
>>  
>> from("file:\\startDirectory?move=endDirectory")
>> .threads(10)
>> .bean("myBean", "myMethod")
>> Afterwards, my route ran successfully but an OverlappingFileLockException
>> was thrown for every file that was read and all the lock files were left
>> in my source directory.
> 
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 
> 

OK.  My process reads a file, does some work on it, writes it to output,
then saves the results to a database.  If the same file is processed twice
there is a database error.

I used the same route and data with readLock equal to markerFile, fileLock,
and rename.  In each case, all the data made it to the database as expected.
With markerFile, an OverlappingFileLockException  was thrown for each file,
each file was moved, and there was a marker file left behind for each file.  

With fileLock, nothing ever got moved, so my process was stuck trying and
failing to process the same files over and over again (since an error was
thrown when the same file was saved to the database twice).

With rename, everything got moved, but the second time a file was accessed a
database file was thrown and the file completely disappeared.  If I let my
process continue long enough all the output files went away.

   I'm pretty sure what's happening is a race condition between the one
Camel thread moving a file and another one reading it again.  You need to
hold you lock until Windows is finished moving the file.

-- 
View this message in context: 
http://www.nabble.com/-jira--Created%3A-%28CAMEL-1670%29-thread%28%29-and-File-Components-tp23879331p23893205.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to