correct java code fragment in javadocs for reopen

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@743303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-02-11 11:14:47 +00:00
parent 6e692d38ec
commit 18b819abe0
1 changed files with 8 additions and 4 deletions

View File

@ -340,14 +340,18 @@ public abstract class IndexReader implements Cloneable {
* <pre>
* IndexReader reader = ...
* ...
* IndexReader new = r.reopen();
* if (new != reader) {
* ... // reader was reopened
* IndexReader newReader = r.reopen();
* if (newReader != reader) {
* ... // reader was reopened
* reader.close();
* }
* reader = new;
* reader = newReader;
* ...
* </pre>
*
* Be sure to synchronize that code so that other threads,
* if present, can never use reader after it has been
* closed and before it's switched to newReader.
*
* @throws CorruptIndexException if the index is corrupt
* @throws IOException if there is a low-level IO error