I just tried on my local system: WindowsXP with NTFS

It worked fine. I had an excel file opened and Camel waited for the
lock. I closed the excel and Camel instantly got the read lock and
continued to operate.

Opening the file in Excel
...
07:15:48 = trying to get the lock
...
Closing the file in Excel
...
07:15:55 = got the lock


2008-12-18 07:15:48,296 [mpon...@110c424] DEBUG FileConsumer
        - Total 1 files to consume
2008-12-18 07:15:48,296 [mpon...@110c424] TRACE FileConsumer
        - Processing file:
target\exclusiveread\Faktureringsgrundlag_ci_1kvartal_2007.xls
2008-12-18 07:15:48,312 [mpon...@110c424] DEBUG FileEndpoint
        - Using file process strategy:
org.apache.camel.component.file.strategy.renamefileprocessstrat...@1bf3d87
2008-12-18 07:15:48,312 [mpon...@110c424] TRACE FileConsumer
        - Waiting for exclusive read lock to file:
target\exclusiveread\Faktureringsgrundlag_ci_1kvartal_2007.xls
2008-12-18 07:15:55,359 [mpon...@110c424] TRACE FileConsumer
        - Acquired exclusive read lock:
sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid] to
file: target\exclusiveread\Faktureringsgrundlag_ci_1kvartal_2007.xls
2008-12-18 07:15:55,359 [mpon...@110c424] DEBUG FileConsumer
        - About to process file:
target\exclusiveread\Faktureringsgrundlag_ci_1kvartal_2007.xls using
exchange: Exchange[FileMessage:
target\exclusiveread\Faktureringsgrundlag_ci_1kvartal_2007.xls]



On Thu, Dec 18, 2008 at 6:18 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> I created ticket to track this issue
> https://issues.apache.org/activemq/browse/CAMEL-1195
>
> On Thu, Dec 18, 2008 at 6:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>> Hi
>>
>> Thanks for the logging. We have a ticket in JIRA to allow a different
>> strategy for exclusive read locks. Currently we only use the java NIO
>> locks. But they do not work consistent on all file systems or not at
>> all. So another strategy is the good old rename the file before
>> reading. This is what we do with the FTP component.
>>
>> So I will see what I can do to get this fixed so you can use the other
>> strategy instead.
>>
>> I assume you use Windows XP? What file system do you use NTFS or FAT32?
>>
>>
>>
>> On Wed, Dec 17, 2008 at 11:12 PM, watcher <patr...@daly.ws> wrote:
>>>
>>> Hi Claus
>>>
>>> Here's the trace logs enabled. If I start may application with the file
>>> already opened in Excel. The error is generated below.
>>>
>>> 17 Dec 2008 22:03:01,484 TRACE [Thread: 1
>>> org.apache.camel.component.file.filecompon...@18be298] Fil
>>> eConsumer.pollFileOrDirectory(95) | Polling directory c:\temp
>>> 17 Dec 2008 22:03:01,484 TRACE [Thread: 1
>>> org.apache.camel.component.file.filecompon...@18be298] Fil
>>> eConsumer.pollFile(119) | Polling file: c:\temp\file.txt
>>> 17 Dec 2008 22:03:01,484 TRACE [Thread: 1
>>> org.apache.camel.component.file.filecompon...@18be298] Fil
>>> eConsumer.acquireExclusiveReadLock(200) | Waiting for exclusive read lock to
>>> file: c:\temp\file.txt
>>>
>>> 17 Dec 2008 22:03:01,484 ERROR [Thread: 1
>>> org.apache.camel.component.file.filecompon...@18be298] FileConsumer.log(188)
>>> | c:\temp\file.txt (The process cannot access the file because it is being u
>>> sed by another process)
>>> java.io.FileNotFoundException: c:\temp\file.txt (The process cannot access
>>> the file because it
>>> is being used by another process)
>>>        at java.io.RandomAccessFile.open(Native Method)
>>>        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
>>>        at
>>> org.apache.camel.component.file.FileConsumer.acquireExclusiveReadLock(FileConsumer.java:2
>>> 04)
>>>
>>> --
>>> View this message in context: 
>>> http://www.nabble.com/FileComponent-FileNotFoundException-tp21054406s22882p21062702.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Reply via email to