Index: src/java/org/apache/lucene/store/FSDirectory.java =================================================================== --- src/java/org/apache/lucene/store/FSDirectory.java (revision 809390) +++ src/java/org/apache/lucene/store/FSDirectory.java (working copy) @@ -129,6 +129,9 @@ * Set whether Lucene's use of lock files is disabled. By default, * lock files are enabled. They should only be disabled if the index * is on a read-only medium like a CD-ROM. + * @deprecated Use a {@link #open(File, LockFactory)} or a constructor + * that takes a {@link LockFactory} and supply + * {@link NoLockFactory#getNoLockFactory}. */ public static void setDisableLocks(boolean doDisableLocks) { FSDirectory.disableLocks = doDisableLocks; @@ -138,6 +141,8 @@ * Returns whether Lucene's use of lock files is disabled. * @return true if locks are disabled, false if locks are enabled. * @see #setDisableLocks + * @deprecated Use a constructor that takes a {@link LockFactory} and + * supply {@link NoLockFactory#getNoLockFactory}. */ public static boolean getDisableLocks() { return FSDirectory.disableLocks; @@ -358,17 +363,23 @@ /** Create a new FSDirectory for the named location (ctor for subclasses). * @param path the path of the directory - * @param lockFactory the lock factory to use, or null for the default. + * @param lockFactory the lock factory to use, or null for the default + * ({@link NativeFSLockFactory}); * @throws IOException */ protected FSDirectory(File path, LockFactory lockFactory) throws IOException { path = getCanonicalPath(path); + // new ctors use always NativeFSLockFactory as default: + if (lockFactory == null) { + lockFactory = new NativeFSLockFactory(path); + } init(path, lockFactory); refCount = 1; } /** Creates an FSDirectory instance, trying to pick the * best implementation given the current environment. + * The directory returned uses the {@link NativeFSLockFactory}. * *
Currently this returns {@link NIOFSDirectory} * on non-Windows JREs and {@link SimpleFSDirectory} Index: src/java/org/apache/lucene/store/MMapDirectory.java =================================================================== --- src/java/org/apache/lucene/store/MMapDirectory.java (revision 809390) +++ src/java/org/apache/lucene/store/MMapDirectory.java (working copy) @@ -74,14 +74,15 @@ /** Create a new MMapDirectory for the named location. * * @param path the path of the directory - * @param lockFactory the lock factory to use, or null for the default. + * @param lockFactory the lock factory to use, or null for the default + * ({@link NativeFSLockFactory}); * @throws IOException */ public MMapDirectory(File path, LockFactory lockFactory) throws IOException { super(path, lockFactory); } - /** Create a new MMapDirectory for the named location and the default lock factory. + /** Create a new MMapDirectory for the named location and {@link NativeFSLockFactory}. * * @param path the path of the directory * @throws IOException Index: src/java/org/apache/lucene/store/NIOFSDirectory.java =================================================================== --- src/java/org/apache/lucene/store/NIOFSDirectory.java (revision 809390) +++ src/java/org/apache/lucene/store/NIOFSDirectory.java (working copy) @@ -43,14 +43,15 @@ /** Create a new NIOFSDirectory for the named location. * * @param path the path of the directory - * @param lockFactory the lock factory to use, or null for the default. + * @param lockFactory the lock factory to use, or null for the default + * ({@link NativeFSLockFactory}); * @throws IOException */ public NIOFSDirectory(File path, LockFactory lockFactory) throws IOException { super(path, lockFactory); } - /** Create a new NIOFSDirectory for the named location and the default lock factory. + /** Create a new NIOFSDirectory for the named location and {@link NativeFSLockFactory}. * * @param path the path of the directory * @throws IOException Index: src/java/org/apache/lucene/store/SimpleFSDirectory.java =================================================================== --- src/java/org/apache/lucene/store/SimpleFSDirectory.java (revision 809390) +++ src/java/org/apache/lucene/store/SimpleFSDirectory.java (working copy) @@ -32,14 +32,15 @@ /** Create a new SimpleFSDirectory for the named location. * * @param path the path of the directory - * @param lockFactory the lock factory to use, or null for the default. + * @param lockFactory the lock factory to use, or null for the default + * ({@link NativeFSLockFactory}); * @throws IOException */ public SimpleFSDirectory(File path, LockFactory lockFactory) throws IOException { super(path, lockFactory); } - /** Create a new SimpleFSDirectory for the named location and the default lock factory. + /** Create a new SimpleFSDirectory for the named location and {@link NativeFSLockFactory}. * * @param path the path of the directory * @throws IOException