Apache Lucene open-source search software
LUCENE-1766: document IndexReader/Searcher's thread safety as well
Michael McCandless9f12a2be6be7
diff --git a/src/java/org/apache/lucene/index/IndexReader.java b/src/java/org/apache/lucene/index/IndexReader.javaindex 0c4e28db114..e3c61251527 100644--- a/src/java/org/apache/lucene/index/IndexReader.java+++ b/src/java/org/apache/lucene/index/IndexReader.java@@ -67,6 +67,14 @@ import java.util.Map;if you want to make changes with the resulting IndexReader.</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$*/public abstract class IndexReader implements Cloneable {diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.javaindex e8c27960cf0..c28d74f62bc 100644--- a/src/java/org/apache/lucene/index/IndexWriter.java+++ b/src/java/org/apache/lucene/index/IndexWriter.java@@ -191,10 +191,10 @@ import java.util.Map;<code>IndexWriter</code>} instances are completely threadsafe, meaning multiple threads can call any of itsmethods, concurrently. If your application requires- external synchronization, you should <b>not</b> use the- <code>IndexWriter</code> instance for synchronization as- this can lead to deadlock. Use a private- <code>Object</code> instead. </p>+ external synchronization, you should <b>not</b>+ synchronize on the <code>IndexWriter</code> instance as+ this may cause deadlock; use your own (non-Lucene) objects+ instead. </p>*//*diff --git a/src/java/org/apache/lucene/search/IndexSearcher.java b/src/java/org/apache/lucene/search/IndexSearcher.javaindex 482760a4a1e..f9690c75657 100644--- a/src/java/org/apache/lucene/search/IndexSearcher.java+++ b/src/java/org/apache/lucene/search/IndexSearcher.java@@ -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* 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 {IndexReader reader;