Unable to delete file after processing on Windows

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unable to delete file after processing on Windows

NP-Hard
Hi,

I'm having a problem where Camel is unable to delete a file after processing it in a route.
Problem occurs only on WinXP; on Linux it works fine.
My route looks something like this:

from( "file://foo?delete=true" ).process( proc1 ).recipientList( header( "xyz" ).tokenize( "," ) );

Here, proc1.process() adds a header named "xyz" which is a comma separated list of ActiveMQ URIs.

The route kicks in, processes the message but the last step of deleting the input file fails with the
stack trace shown below. Changing the file disposition to rename makes no difference and it fails
the same way. From the stack trace, it looks like a thread is trying to do the delete while another
thread still has the file locked.

Any help is much appreciated, thanks.

=================================================================
     [java] org.apache.camel.component.file.GenericFileOperationFailedException: Cannot delete file: GenericFile[five.txt]
     [java]     at org.apache.camel.component.file.strategy.GenericFileDeletePro cessStrategy.commit(GenericFileDeleteProcessStrategy.java:59)
     [java]     at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:125)
     [java]     at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:85)
     [java]     at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
     [java]     at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:131)
     [java]     at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:60)
     [java]     at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
     [java]     at org.apache.camel.management.InstrumentationProcessor.process(nstrumentationProcessor.java:67)
     [java]     at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:201)
     [java]     at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:122)
     [java]     at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:95)
     [java]     at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
     [java]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
     [java]     at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
     [java]     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
     [java]     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
     [java]     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
     [java]     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
     [java]     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
     [java]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
     [java]     at java.lang.Thread.run(Thread.java:619)
========================================================================