Stefan,
your locksDisabled() method is a reimplementation of functionality already
provided by the Java SDK:
Boolean.getBoolean(String name) does exactly what your method does:
Returns true if and only if the system property named by the argument exists
and is equal to the string "true".
-----Original Message-----
From: Stefan Bergstrand
To: Lucene Developer
Sent: 6/12/02 3:28 AM
Subject: Re: Locking problems
Ok, now I have fixed a way to turn locking off. Here is the modified
method in FSDirectory, and a helper method. Locking is turned off by
setting -DdisableLuceneLocks=true on the command line.
Thanks to Matt Tucker for pointing out the place where to modify.
/Stefan B
/** Construct a {@link Lock}.
* @param name the name of the lock file
*/
public final Lock makeLock(String name) {
final File lockFile = new File(directory, name);
return new Lock() {
public boolean obtain() throws IOException {
if (locksDisabled()){
return true;
}
if (Constants.JAVA_1_1)
return true; // locks disabled in jdk 1.1
return lockFile.createNewFile();
}
public void release() {
if (locksDisabled()){
return;
}
if (Constants.JAVA_1_1)
return; // locks disabled in jdk 1.1
lockFile.delete();
}
public String toString() {
return "Lock@" + lockFile;
}
};
}
protected final boolean locksDisabled(){
if (System.getProperty("disableLuceneLocks") == null){
return false;
} else {
return
System.getProperty("disableLuceneLocks").equals("true");
}
}
--
---------------------------
Stefan Bergstrand
Polopoly - Cultivating the information garden
Kungsgatan 88, SE-112 27 Stockholm, SWEDEN
Ph: +46 8 506 782 67
Cell: +46 704 47 82 67
stefan.bergstrand@polopoly.com, http://www.polopoly.com
--
To unsubscribe, e-mail:
<mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:lucene-dev-help@jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
|