LUCENE-1766: document IndexReader/Searcher's thread safety as well

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@799011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-07-29 18:53:25 +00:00
parent afb517e832
commit 9f12a2be6b
3 changed files with 20 additions and 4 deletions

View File

@ -67,6 +67,14 @@ import java.util.Map;
if you want to make changes with the resulting IndexReader. if you want to make changes with the resulting IndexReader.
</p> </p>
<a name="thread-safety"></a><p><b>NOTE</b>: {@link
<code>IndexReader</code>} instances are completely thread
safe, meaning multiple threads can call any of its methods,
concurrently. If your application requires external
synchronization, you should <b>not</b> synchronize on the
<code>IndexReader</code> instance; use your own
(non-Lucene) objects instead.
@version $Id$ @version $Id$
*/ */
public abstract class IndexReader implements Cloneable { public abstract class IndexReader implements Cloneable {

View File

@ -191,10 +191,10 @@ import java.util.Map;
<code>IndexWriter</code>} instances are completely thread <code>IndexWriter</code>} instances are completely thread
safe, meaning multiple threads can call any of its safe, meaning multiple threads can call any of its
methods, concurrently. If your application requires methods, concurrently. If your application requires
external synchronization, you should <b>not</b> use the external synchronization, you should <b>not</b>
<code>IndexWriter</code> instance for synchronization as synchronize on the <code>IndexWriter</code> instance as
this can lead to deadlock. Use a private this may cause deadlock; use your own (non-Lucene) objects
<code>Object</code> instead. </p> instead. </p>
*/ */
/* /*

View File

@ -36,6 +36,14 @@ import org.apache.lucene.store.Directory;
* *
* <p>Note that you can only access Hits from an IndexSearcher as long as it is * <p>Note that you can only access Hits from an IndexSearcher as long as it is
* not yet closed, otherwise an IOException will be thrown. * not yet closed, otherwise an IOException will be thrown.
*
* <a name="thread-safety"></a><p><b>NOTE</b>: {@link
* <code>IndexSearcher</code>} instances are completely
* thread safe, meaning multiple threads can call any of its
* methods, concurrently. If your application requires
* external synchronization, you should <b>not</b>
* synchronize on the <code>IndexSearcher</code> instance;
* use your own (non-Lucene) objects instead.</p>
*/ */
public class IndexSearcher extends Searcher { public class IndexSearcher extends Searcher {
IndexReader reader; IndexReader reader;