Skip to content

Apache Lucene open-source search software

LUCENE-1766: spell out IndexWriter's thread safety in the javadocs

Michael McCandless8d5b662535fc
diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java
index e673bc73cd8..e8c27960cf0 100644
--- a/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/src/java/org/apache/lucene/index/IndexWriter.java
@@ -186,6 +186,15 @@ import java.util.Map;
last commit. If you opened the writer with autoCommit
false you can also just call {@link #rollback()}
directly.</p>
+
+ <a name="thread-safety"></a><p><b>NOTE</b>: {@link
+ <code>IndexWriter</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> use the
+ <code>IndexWriter</code> instance for synchronization as
+ this can lead to deadlock. Use a private
+ <code>Object</code> instead. </p>
*/
/*