lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <j...@apache.org>
Subject [jira] Closed: (LUCENE-568) [PATCH]Multiple threads performance enhancement when querying.
Date Wed, 10 May 2006 04:34:06 GMT
     [ 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 index@--@");
>         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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message