jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r756429 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene: CachingIndexReader.java IndexMerger.java MultiIndex.java
Date Fri, 20 Mar 2009 12:27:01 GMT
Author: mreutegg
Date: Fri Mar 20 12:27:01 2009
New Revision: 756429

URL: http://svn.apache.org/viewvc?rev=756429&view=rev
Log:
JCR-2027: Remove background initialization of hierarchy cache

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
    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/CachingIndexReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java?rev=756429&r1=756428&r2=756429&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java
Fri Mar 20 12:27:01 2009
@@ -33,10 +33,6 @@
 import java.util.Iterator;
 import java.text.NumberFormat;
 
-import EDU.oswego.cs.dl.util.concurrent.Executor;
-import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-
 /**
  * Implements an <code>IndexReader</code> that maintains caches to resolve
  * {@link #getParent(int, BitSet)} calls efficiently.
@@ -50,17 +46,6 @@
     private static final Logger log = LoggerFactory.getLogger(CachingIndexReader.class);
 
     /**
-     * The single thread of this executor initializes the
-     * {@link #parents} when background initialization is requested.
-     */
-    private static final Executor SERIAL_EXECUTOR = new PooledExecutor(
-            new LinkedQueue(), 1) {
-        {
-            setKeepAliveTime(500);
-        }
-    };
-
-    /**
      * The current value of the global creation tick counter.
      */
     private static long currentTick;
@@ -95,8 +80,7 @@
      * @param cache     a document number cache, or <code>null</code> if not
      *                  available to this reader.
      * @param initCache if the {@link #parents} cache should be initialized
-     *                  when this index reader is constructed. Otherwise
-     *                  initialization happens in a background thread.
+     *                  when this index reader is constructed.
      * @throws IOException if an error occurs while reading from the index.
      */
     CachingIndexReader(IndexReader delegatee,
@@ -109,12 +93,6 @@
         this.cacheInitializer = new CacheInitializer(delegatee);
         if (initCache) {
             cacheInitializer.run();
-        } else {
-            try {
-                SERIAL_EXECUTOR.execute(cacheInitializer);
-            } catch (InterruptedException e) {
-                // ignore
-            }
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java?rev=756429&r1=756428&r2=756429&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java
Fri Mar 20 12:27:01 2009
@@ -302,12 +302,6 @@
                             docCount += readers[i].numDocs();
                         }
                         log.info("merged " + docCount + " documents in " + time + " ms into
" + index.getName() + ".");
-
-                        // force initializing of caches
-                        time = System.currentTimeMillis();
-                        index.getReadOnlyIndexReader(true).release();
-                        time = System.currentTimeMillis() - time;
-                        log.debug("reader obtained in {} ms", new Long(time));
                     } finally {
                         for (int i = 0; i < readers.length; i++) {
                             try {

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=756429&r1=756428&r2=756429&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
Fri Mar 20 12:27:01 2009
@@ -622,6 +622,14 @@
                         Collection deleted)
             throws IOException {
 
+        if (handler.isInitializeHierarchyCache()) {
+            // force initializing of caches
+            long time = System.currentTimeMillis();
+            index.getReadOnlyIndexReader(true).release();
+            time = System.currentTimeMillis() - time;
+            log.debug("hierarchy cache initialized in {} ms", new Long(time));
+        }
+
         synchronized (this) {
             synchronized (updateMonitor) {
                 updateInProgress = true;
@@ -690,8 +698,6 @@
      *
      * @param initCache when set <code>true</code> the hierarchy cache is
      *                  completely initialized before this call returns.
-     *                  Otherwise the cache is initialized in a background
-     *                  thread.
      * @return an <code>IndexReader</code>.
      * @throws IOException if an error occurs constructing the <code>IndexReader</code>.
      */



Mime
View raw message