In my system indices are created and updated by multiple threads. I need to check if
an index exists to decide whether to pass true or false to the IndexWriter constructor.
new IndexWriter(FSDirectory, Analyzer, boolean);
The problem arises when two threads attempt to create the same index after
simultaneously finding that the index does not exist. This problem can be reproduced
in a single thread by
writerA = new IndexWriter(new File("c:/import/test"), new StandardAnalyzer(), true);
writerB = new IndexWriter(new File("c:/import/test"), new StandardAnalyzer(), true);
add1000Docs(writerA);
add1000Docs(writerB);
this will throw an IOException
C:\import\test\_a.fnm (The system cannot find the file specified)
The only solution I can think of is to create a database/file lock to get around this,
or change the Lucene code to obtain a lock before creating an index. Any ideas?
David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]