You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "maria.iracheta@gmail.com" <ma...@gmail.com> on 2011/03/18 13:25:18 UTC

org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Hi,

I think that MarkerFileExclusiveReadLockStrategy is not thread-safe. When I
run  a File endpoint with more than one thread the
MarkerFileExclusiveReadLockStrategy only deletes the last file to start
being processed.

The MarkerFileExclusiveReadLockStrategy uses global variables:
private File lock;
private String lockFileName;
and gives them values on the acquireExclusiveReadLock method. When another
thread calls the releaseExclusiveReadLock method it uses the global
variables to delete the locked file. That means that if another thread came
and called the acquireExclusiveReadLock it would have changed the values on
the global variables.

If lock and lockFileName are not global variables the problem seems to
disappear and I can a multithreaded File endpoint and not locked file is
left undeleted.

Thanks,

Maria

--
View this message in context: http://camel.465427.n5.nabble.com/org-apache-camel-component-file-strategy-MarkerFileExclusiveReadLockStrategy-is-not-thread-safe-tp3960266p3960266.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy is not thread-safe

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Thanks for reporting this issue. Could you create a JIRA ticket?

Link to JIRA from here:
http://camel.apache.org/support



On Fri, Mar 18, 2011 at 1:25 PM, maria.iracheta@gmail.com
<ma...@gmail.com> wrote:
> Hi,
>
> I think that MarkerFileExclusiveReadLockStrategy is not thread-safe. When I
> run  a File endpoint with more than one thread the
> MarkerFileExclusiveReadLockStrategy only deletes the last file to start
> being processed.
>
> The MarkerFileExclusiveReadLockStrategy uses global variables:
> private File lock;
> private String lockFileName;
> and gives them values on the acquireExclusiveReadLock method. When another
> thread calls the releaseExclusiveReadLock method it uses the global
> variables to delete the locked file. That means that if another thread came
> and called the acquireExclusiveReadLock it would have changed the values on
> the global variables.
>
> If lock and lockFileName are not global variables the problem seems to
> disappear and I can a multithreaded File endpoint and not locked file is
> left undeleted.
>
> Thanks,
>
> Maria
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/org-apache-camel-component-file-strategy-MarkerFileExclusiveReadLockStrategy-is-not-thread-safe-tp3960266p3960266.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/