--- lucene-java-2.3.2/src/java/org/apache/lucene/index/IndexReader.java 2007-11-26 15:31:39.000000000 -0800 +++ lucene-java-2.3.2-patched/src/java/org/apache/lucene/index/IndexReader.java 2008-07-17 02:34:54.000000000 -0700 @@ -159,16 +159,30 @@ * @throws AlreadyClosedException if this IndexReader is closed */ protected final void ensureOpen() throws AlreadyClosedException { if (refCount <= 0) { throw new AlreadyClosedException("this IndexReader is closed"); } } + public synchronized void acquire() + throws AlreadyClosedException + { + ensureOpen(); + incRef(); + } + + public synchronized void release() + throws AlreadyClosedException, IOException + { + ensureOpen(); + decRef(); + } + /** Returns an IndexReader reading the index in an FSDirectory in the named path. * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error * @param path the path to the index directory */ public static IndexReader open(String path) throws CorruptIndexException, IOException { return open(FSDirectory.getDirectory(path), true, null); }