You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Char <ch...@gmx.net> on 2008/11/26 15:08:50 UTC

Polling very large files

Hello servicemix-community!

I have a jbi:file-poller component that has to poll large files (30MB).
Sometimes, i get a FileNotFoundException, because the poller tries to read
the file before the copy-task has finished.

I tried to solve this by implementing my own LockManager, which tries to
check before whether the file is now ready to be read or not. But
unfortunately, this doesn't work well...

So, what is the common workaround here?

thanks for your help

charx
-- 
View this message in context: http://www.nabble.com/Polling-very-large-files-tp20701486p20701486.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Polling very large files

Posted by Lars Heinemann <lh...@apache.org>.
Maybe you can solve this within your LockManager.
When looking at the code you could do some workaround for it.

                String uri =
file.toURI().relativize(aFile.toURI()).toString();
                Lock lock = lockManager.getLock(uri);
                if (lock.tryLock()) {
                    processFileNow(aFile);
                }  ....

Now imagine in the tryLock() method you have some check logic that
determines the fileSize, wait some millis and again determine the fileSize.
Now compare the 2 sizes and if not equal than the copying is most likely not
finished yet and you should return false, otherwise return true.

Anyway you are free to raise a JIRA for this.

Regards
Lars



2008/11/26 Char <ch...@gmx.net>

>
> Hello servicemix-community!
>
> I have a jbi:file-poller component that has to poll large files (30MB).
> Sometimes, i get a FileNotFoundException, because the poller tries to read
> the file before the copy-task has finished.
>
> I tried to solve this by implementing my own LockManager, which tries to
> check before whether the file is now ready to be read or not. But
> unfortunately, this doesn't work well...
>
> So, what is the common workaround here?
>
> thanks for your help
>
> charx
> --
> View this message in context:
> http://www.nabble.com/Polling-very-large-files-tp20701486p20701486.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
http://lhein.blogspot.com