[ http://issues.apache.org/jira/browse/LUCENE-568?page=all ]
Yonik Seeley closed LUCENE-568:
-------------------------------
Resolution: Invalid
Assign To: Yonik Seeley
I'm closing this improvement without commiting since the proposed change is in
the form of a well known anti-pattern called double-checked locking. The bug is
hard enough to spot and hard to test for correctness, so I'm afraid of leaving
this bug open since others may patch their local versions.
> [PATCH]Multiple threads performance enhancement when querying.
> --------------------------------------------------------------
>
> Key: LUCENE-568
> URL: http://issues.apache.org/jira/browse/LUCENE-568
> Project: Lucene - Java
> Type: Improvement
> Components: Search
> Versions: 1.9
> Environment: OS: Red Hat EL 3
> Machine: Dual CPUs, 1024M Ram, 100Giga bytes SCSI disks.
> Lucene 1.9.1
> JVM:JDK1.5.06
> Reporter: Yueyu Lin
> Assignee: Yonik Seeley
> Attachments: TermInfosReader.java
>
> This improvement will reduce the wait when TermInfosReader calls
> ensureIndexIsRead().
> The small trick like below:
> ....
> private void ensureIndexIsRead() throws IOException {
> if (indexTerms != null) // index already read
> return; // do nothing
> synchronized(this){
> System.out.println("Read [EMAIL PROTECTED]@");
> if(indexTerms != null){
> System.out.println ("Someone read it.return-_-");
> return ;
> }
> readIndex ();
> }
> }
>
> private synchronized void readIndex() throws IOException{
> Term[] m_indexTerms = null;
> try {
> int indexSize = (int)indexEnum.size; // otherwise read index
> m_indexTerms = new Term[indexSize];
> indexInfos = new TermInfo[indexSize];
> indexPointers = new long[indexSize];
> for (int i = 0; indexEnum.next(); i++) {
> m_indexTerms[i] = indexEnum.term();
> indexInfos[i] = indexEnum.termInfo();
> indexPointers[i] = indexEnum.indexPointer;
> }
> } finally {
> indexEnum.close();
> indexEnum = null;
> indexTerms = m_indexTerms;
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]