diff --git a/lucene/core/src/java/org/apache/lucene/store/Directory.java b/lucene/core/src/java/org/apache/lucene/store/Directory.java index bacf2d1681b..a94b906e22a 100644 --- a/lucene/core/src/java/org/apache/lucene/store/Directory.java +++ b/lucene/core/src/java/org/apache/lucene/store/Directory.java @@ -40,6 +40,10 @@ import org.apache.lucene.util.IOUtils; * java.nio.file.FileAlreadyExistsException}. * * + *

NOTE: If your application requires external synchronization, you should not + * synchronize on the Directory implementation instance as this may cause deadlock; use + * your own (non-Lucene) objects instead. + * * @see FSDirectory * @see ByteBuffersDirectory * @see FilterDirectory diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java index f31a3a1f880..fa2dd16385e 100644 --- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java +++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java @@ -77,6 +77,10 @@ import org.apache.lucene.util.SuppressForbidden; * Thread#interrupt()} or {@link Future#cancel(boolean)} you should use the legacy {@code * RAFDirectory} from the Lucene {@code misc} module in favor of {@link MMapDirectory}. * + *

NOTE: If your application requires external synchronization, you should not + * synchronize on the MMapDirectory instance as this may cause deadlock; use your own + * (non-Lucene) objects instead. + * * @see Blog post * about MMapDirectory */