Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 95675 invoked from network); 14 Jan 2004 18:08:31 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 14 Jan 2004 18:08:31 -0000 Received: (qmail 94543 invoked by uid 500); 14 Jan 2004 18:08:19 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 94355 invoked by uid 500); 14 Jan 2004 18:08:17 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 94329 invoked from network); 14 Jan 2004 18:08:17 -0000 Received: from unknown (HELO mta1.lbl.gov) (128.3.41.24) by daedalus.apache.org with SMTP; 14 Jan 2004 18:08:17 -0000 Received: from mta1.lbl.gov (localhost [127.0.0.1]) by mta1.lbl.gov (8.12.10/8.12.10) with ESMTP id i0EI8Iqc026880 for ; Wed, 14 Jan 2004 10:08:19 -0800 (PST) Received: from lbl.gov (imapb.lbl.gov [128.3.41.51]) by mta1.lbl.gov (8.12.10/8.12.10) with ESMTP id i0EI8IOW026877 for ; Wed, 14 Jan 2004 10:08:18 -0800 (PST) From: DMGoodstein@lbl.gov Received: from [198.129.90.96] by imapb.lbl.gov (mshttpd); Wed, 14 Jan 2004 10:08:18 -0800 To: Lucene Users List Message-ID: <1f1ffd1f2cf1.1f2cf11f1ffd@lbl.gov> Date: Wed, 14 Jan 2004 10:08:18 -0800 X-Mailer: iPlanet Messenger Express 5.2 HotFix 1.21 (built Sep 8 2003) MIME-Version: 1.0 Content-Language: en Subject: Re: Multiple Creation of Writers X-Accept-Language: en Priority: normal Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N use standard java synchronization (either method-syncrhonization or block-level synchronization) to make sure that only one thread at a time can perform the check for index existence. The test for an existing index and the subsequent creation of an IndexWriter should occur in the same synchronized block of code. --David Goodstein Computational Biology Group Joint Genome Institute ----- Original Message ----- From: David Townsend Date: Wednesday, January 14, 2004 9:48 am Subject: Multiple Creation of Writers > 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: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org