Index: /home/michael/projects/apache/jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java
===================================================================
--- /home/michael/projects/apache/jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java	(revision 531161)
+++ /home/michael/projects/apache/jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/FSDirectory.java	(working copy)
@@ -16,16 +16,19 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.lucene.util.Constants;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.Lock;
+import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.store.IndexInput;
-
-import java.io.IOException;
-import java.io.File;
-import java.util.Map;
-import java.util.HashMap;
+import org.apache.lucene.store.Lock;
 
 /**
  * This is a wrapper class to provide lock creation in the index directory.
@@ -42,8 +45,8 @@
     /**
      * Flag indicating whether locks are disabled
      */
-    private static final boolean DISABLE_LOCKS =
-            Boolean.getBoolean("disableLuceneLocks") || Constants.JAVA_1_1;
+    private static final boolean DISABLE_LOCKS = true;
+            //Boolean.getBoolean("disableLuceneLocks") || Constants.JAVA_1_1;
 
     /**
      * The actual FSDirectory implementation
@@ -110,8 +113,30 @@
      * @return a Lock object with the given name.
      */
     public Lock makeLock(String name) {
-        final File lockFile = new File(directory, name);
+        
+        final File f = new File(directory, name);
+
+        if (!f.exists()) {
+            try {
+                f.createNewFile();
+            } catch ( IOException e ) {
+                throw new IllegalStateException(e);
+            }
+        }
+        RandomAccessFile lockFile;
+        try {
+            lockFile = new RandomAccessFile(new File(directory, name),"rw");
+        } catch ( FileNotFoundException e1 ) {
+            throw new IllegalStateException(e1);
+        }
+        
+        final FileChannel channel = lockFile.getChannel();
+       
+        
         return new Lock() {
+            
+            private FileLock lock;
+            
             public boolean obtain() throws IOException {
                 if (DISABLE_LOCKS) {
                     return true;
@@ -116,7 +141,9 @@
                 if (DISABLE_LOCKS) {
                     return true;
                 }
-                return lockFile.createNewFile();
+                lock = channel.lock();
+                
+                return true;
             }
 
             public void release() {
@@ -123,7 +150,14 @@
                 if (DISABLE_LOCKS) {
                     return;
                 }
-                lockFile.delete();
+                if (lock != null) {
+                    try {
+                        lock.release();
+                    } catch ( IOException e ) {
+                        throw new IllegalStateException(e);
+                    }
+                }
+
             }
 
             public boolean isLocked() {
@@ -130,11 +164,16 @@
                 if (DISABLE_LOCKS) {
                     return false;
                 }
-                return lockFile.exists();
+                if (lock != null) {
+                    return lock.isValid();
+                } else {
+                    return false;
+                }
+
             }
 
             public String toString() {
-                return "Lock@" + lockFile;
+                return "Lock@" + f;
             }
         };
     }
