--- java/src/org/apache/xindice/core/Database.java (revision 548096) +++ java/src/org/apache/xindice/core/Database.java (working copy) @@ -348,14 +348,15 @@ } // Put a lock (at least attempt to) on the database - // FIXME: Use JDK1.4 FileLock File lock = new File(getCollectionRoot(), "db.lock"); try { - if (lock.exists() && !lock.delete()) { - throw new IOException("Could not delete lock file."); + this.lock = new FileOutputStream(lock); + + if (this.lock.getChannel().tryLock() != null) { + this.lock.write(new Date().toString().getBytes()); + } else { + throw new IOException("Unable to acquire file lock."); } - this.lock = new FileOutputStream(lock); - this.lock.write(new Date().toString().getBytes()); } catch (IOException e) { throw new XindiceException("Unable to open lock file " + lock + ". " + "Make sure database is not open by another process. " +