You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anoordover <an...@live.nl> on 2011/06/08 23:30:20 UTC

file component: fileLock en preMove doesn't work

When using a file route with a preMove and a fileLock the move failes in
windows:

2011-06-08 23:04:05,599 [Camel (camel) thread #0 - file:///camel] DEBUG
org.apache.camel.util.FileUtil  - Tried 3 to rename file: C:\camel\test3.txt
to: C:\camel\tmp\test3.txt with result: false
2011-06-08 23:04:05,600 [Camel (camel) thread #0 - file:///camel] DEBUG
org.apache.camel.component.file.FileConsumer  -
Endpoint[file:///camel?move=..%2Fdone&moveFailed=..%2Ferror&preMove=tmp&readLock=fileLock]
cannot begin processing file: GenericFile[C:\camel\test3.txt] due to: Cannot
rename file: GenericFile[C:\camel\test3.txt] to:
GenericFile[C:\camel\tmp\test3.txt]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
rename file: GenericFile[C:\camel\test3.txt] to:
GenericFile[C:\camel\tmp\test3.txt]
	at
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)
	at
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:42)
	at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:278)
	at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
	at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)


I have the impression that this can't be solved. I think that locking a file
in windows blocks the renaming of the locked file.

--
View this message in context: http://camel.465427.n5.nabble.com/file-component-fileLock-en-preMove-doesn-t-work-tp4470994p4470994.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: file component: fileLock en preMove doesn't work

Posted by Claus Ibsen <cl...@gmail.com>.
The FileLock is OS dependent how that works.
So if it wont work on Windows it may work on other OS's.


On Wed, Jun 8, 2011 at 11:30 PM, anoordover <an...@live.nl> wrote:
> When using a file route with a preMove and a fileLock the move failes in
> windows:
>
> 2011-06-08 23:04:05,599 [Camel (camel) thread #0 - file:///camel] DEBUG
> org.apache.camel.util.FileUtil  - Tried 3 to rename file: C:\camel\test3.txt
> to: C:\camel\tmp\test3.txt with result: false
> 2011-06-08 23:04:05,600 [Camel (camel) thread #0 - file:///camel] DEBUG
> org.apache.camel.component.file.FileConsumer  -
> Endpoint[file:///camel?move=..%2Fdone&moveFailed=..%2Ferror&preMove=tmp&readLock=fileLock]
> cannot begin processing file: GenericFile[C:\camel\test3.txt] due to: Cannot
> rename file: GenericFile[C:\camel\test3.txt] to:
> GenericFile[C:\camel\tmp\test3.txt]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> rename file: GenericFile[C:\camel\test3.txt] to:
> GenericFile[C:\camel\tmp\test3.txt]
>        at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)
>        at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:42)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:278)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:619)
>
>
> I have the impression that this can't be solved. I think that locking a file
> in windows blocks the renaming of the locked file.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/file-component-fileLock-en-preMove-doesn-t-work-tp4470994p4470994.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/