lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hui Ouyang" <>
Subject RE: as lock dir .... once again
Date Wed, 03 Mar 2004 03:43:02 GMT
I had to do something similar to make the application works with lucene 1.3 final when upgrading
from 1.3 RC1. I think it is better to maintain back compatiable so existing users are not
affected too much when a new release is available.

	-----Original Message----- 
	From: Michael Duval [] 
	Sent: Tue 3/2/2004 4:11 PM 
	Subject: as lock dir .... once again

	Hello All,
	I've come across my first gotcha with the system property
	"" as the lock directory.
	Over here at APS we run lucene in two different servlet containers on
	two different servers for both performance
	and security reasons.  One container gives read access to the collection
	and the other is contantly updating the collection.
	The collection is NFS mounted from both servers.   This worked fine
	until the lucene update 1.3.   Now the lock files are being
	written to the temp dir's in each of the respective containers root
	dir's.   This of course breaks the locking scheme.
	I could have changed the tmpdir prop to write files back into the
	collection directory but this would also pollute
	the tmpdir with other non-related files.  My solution was as follows:
	I've hacked the code for the time being by updating FSDirectory and
	replaced all System.getProperty("")
	calls with a call to a new method "getLockDir()".   This method checks
	for a "lucene.lockdir" prop before the
	"" prop giving the end user a bit more flexibility in
	where locks are stored.
	Here is the method:
	  /** Allow flexible locking directories - Michael R. Duval 3/02/04 */
	  private String getLockDir() {
	        String lockDir;
	        if ((lockDir = System.getProperty("lucene.lockdir")) == null)
	                return System.getProperty("");
	                return  lockDir;
	Hopefully a solution similar to this will make it in to one of the next
	Thanks and Cheers,
	Michael R. Duval < >
	E-Journal Programmer/Analyst
	The American Physical Society
	1 Research Road
	Ridge, NY 11961
	631 591 4127
	To unsubscribe, e-mail:
	For additional commands, e-mail:

View raw message