Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 66587 invoked from network); 10 May 2006 05:51:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 May 2006 05:51:45 -0000 Received: (qmail 63927 invoked by uid 500); 10 May 2006 05:51:42 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 63891 invoked by uid 500); 10 May 2006 05:51:42 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 63879 invoked by uid 99); 10 May 2006 05:51:42 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 22:51:42 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [169.229.70.167] (HELO rescomp.berkeley.edu) (169.229.70.167) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2006 22:51:39 -0700 Received: by rescomp.berkeley.edu (Postfix, from userid 1007) id 493565B764; Tue, 9 May 2006 22:51:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by rescomp.berkeley.edu (Postfix) with ESMTP id 401267F403 for ; Tue, 9 May 2006 22:51:14 -0700 (PDT) Date: Tue, 9 May 2006 22:51:14 -0700 (PDT) From: Chris Hostetter To: Lucene Dev Subject: RE: Multiple threads searching in Lucene and the synchronized issue. -- solution attached. In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N : I think you could use a volatile primitive boolean to control whether or not : the index needs to be read, and also mark the index data volatile and it : SHOULD PROBABLY work. : : But as stated, I don't think the performance difference is worth it. My understanding is: 1) volatile will only help as of java 1.5 ... lucene targets 1.4 compatibility. 2) in 1.5, volatile is basically just as expensive as synchronized. : I met these problem before indeed.The compiler did something optimized for : me that was bad for me when I see the byte-codes. : When I'm using a function local variable, m_indexTerms and in JDK1.5.06, it : seems ok. : Whether it will break in other environments, I still don't know about it. The dangerous thing is that even if the byte code looks okay, and if it works okay today, your app could run for a while and then all of the sudden it could stop working because of the order the threads are run, or becuase of an optimization the JVM applies on the fly. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org