svn commit: r565815 - /lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: rfrovarp
Date: Tue Aug 14 08:59:51 2007
New Revision: 565815

URL: http://svn.apache.org/viewvc?view=rev&rev=565815
Log:
Now releases lock while waiting for indexer to be released.

Modified:
    lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java?view=diff&rev=565815&r1=565814&r2=565815
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/Index.java Tue Aug 14 08:59:51 2007
@@ -141,15 +141,13 @@
      */
     public synchronized Indexer getIndexer() throws IndexException {
 
-        int tmptries = numtries;
-
+        long endTime = System.currentTimeMillis() + numtries * 1000;
         // wait the end of the indexing
-        while (indexer_busy && tmptries > 0) {
+        while (indexer_busy && System.currentTimeMillis() < endTime) {
             try {
-                Thread.sleep(1000);
+                wait(1000);
             } catch (InterruptedException ex) {
             }
-            tmptries--;
         }
 
         if (indexer_busy) {
@@ -191,6 +189,7 @@
             this.manager.release(indexer);
             indexer_busy = false;
         }
+        notifyAll();
     }
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.