Index: src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (revision 754884) +++ src/main/java/org/apache/jackrabbit/core/query/lucene/CachingIndexReader.java (working copy) @@ -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 IndexReader 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 null 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 - } } } Index: src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java (revision 754884) +++ src/main/java/org/apache/jackrabbit/core/query/lucene/IndexMerger.java (working copy) @@ -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 { Index: src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (revision 754884) +++ src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (working copy) @@ -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 true the hierarchy cache is * completely initialized before this call returns. - * Otherwise the cache is initialized in a background - * thread. * @return an IndexReader. * @throws IOException if an error occurs constructing the IndexReader. */