Doug, thanks for your suggestions! I will implement your solution and make it public. We already use a 1.4 JVM, so we have no problems with that.
The only problem is that, as lucene 1.4rc2, FSDirectory is 'final'; I would go for the subclassing solution if you can make it not final; otherwise, if someone has good arguments for the single 'fat' FSDirectory solution, just let me know it. In fact, a third architectural approach would be to define an API for "pluggable" lock implementations: IMHO that would be more robust to changes in the Directory interface and implementations. Thanks again! Francesco Doug Cutting <[EMAIL PROTECTED]> wrote: > Francesco Bellomi wrote: >> we are experiencing some difficulties in using Lucene with a NFS >> filesystem. Basically, locking seems not to work properly, since it >> appears that >> attempted concurring writing on the index (from different VMs) are >> not >> blocked, and this often causes the index to be corrupted. >> >> Does anybody have a solution for this problem? Does anyone have some >> suggestions about the implementation of some alternative approach for >> locking, in order to make Lucene compatible with NFS? > > I just found the following article, which might point the way: > > http://www.spinnaker.de/linux/nfs-locking.html > > FSDirectory.lock currently implements what this article calls > "dotlocking". One can implement fcntl() locking using nio, but this > requires a 1.4 JVM, which Lucene does not (yet). > > http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/FileChannel.html#t ryLock() > > A couple of alternatives: > > 1. One could implement a 1.4-only subclass of FSDirectory in the > Sandbox > that implements dotlocking plus fcntl() locking. > > 2. We could add this directly into FSDirectory so that it will only > compile in 1.4+ JDKs, but that it will run in earlier JDKs by only > performing fcntl() locking when in a 1.4+ JVM. Some folks would > complain. > > Thoughts? > > Doug > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - Francesco Bellomi "Use truth to show illusion, and illusion to show truth." --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]