You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2009/11/30 14:06:34 UTC

svn commit: r885411 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java

Author: mreutegg
Date: Mon Nov 30 13:06:33 2009
New Revision: 885411

URL: http://svn.apache.org/viewvc?rev=885411&view=rev
Log:
JCR-2413: AlreadyClosedException on initial index creation

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=885411&r1=885410&r2=885411&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java Mon Nov 30 13:06:33 2009
@@ -329,7 +329,7 @@
         flushTask = new Timer.Task() {
             public void run() {
                 // check if there are any indexing jobs finished
-                checkIndexingQueue();
+                checkIndexingQueue(false);
                 // check if volatile index should be flushed
                 checkFlush();
             }
@@ -1266,17 +1266,6 @@
 
     /**
      * Checks the indexing queue for finished text extrator jobs and updates the
-     * index accordingly if there are any new ones. This method is synchronized
-     * and should only be called by the timer task that periodically checks if
-     * there are documents ready in the indexing queue. A new transaction is
-     * used when documents are transfered from the indexing queue to the index.
-     */
-    private synchronized void checkIndexingQueue() {
-        checkIndexingQueue(false);
-    }
-
-    /**
-     * Checks the indexing queue for finished text extrator jobs and updates the
      * index accordingly if there are any new ones.
      *
      * @param transactionPresent whether a transaction is in progress and the
@@ -1304,11 +1293,13 @@
 
             try {
                 if (transactionPresent) {
-                    for (NodeId id : finished.keySet()) {
-                        executeAndLog(new DeleteNode(getTransactionId(), id));
-                    }
-                    for (Document document : finished.values()) {
-                        executeAndLog(new AddNode(getTransactionId(), document));
+                    synchronized (this) {
+                        for (NodeId id : finished.keySet()) {
+                            executeAndLog(new DeleteNode(getTransactionId(), id));
+                        }
+                        for (Document document : finished.values()) {
+                            executeAndLog(new AddNode(getTransactionId(), document));
+                        }
                     }
                 } else {
                     update(finished.keySet(), finished.values());