lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stas Chetvertkov" <schetvert...@oilspace.com>
Subject Re: FileNotFoundException while indexing
Date Fri, 11 Oct 2002 17:12:35 GMT
Well... there is one thing with my solution. I implemented it using native
code since I found no way to do it in Java :(

Here is an excerpt from 'man 2 creat':

...O_EXCL is broken on  NFS  file systems, programs which rely on it for
performing locking tasks will contain a race condition.  The solution for
performing atomic file locking using a lockfile is to create a unique file
on the same fs  (e.g.,  incorporating  hostname and pid), use link(2) to
make a link to the lockfile. If link() returns 0, the lock is successful.
Otherwise, use stat(2) on the unique file to check if its  link count has
increased to 2, in which case the lock is also successful....

This is exactly what I did for locking. I am attaching code that solved the
problem for me (my OS is Linux).

By the way, maybe somebody knows why almost all classes / methods in Lucene
are final? I would surely prefer to inherit from FSDirectory instead of
writing a wrapper around it.

Cheers,
Stas.

----- Original Message -----
From: "Terry Steichen" <terry@net-frame.com>
To: "Lucene Users List" <lucene-user@jakarta.apache.org>
Sent: Friday, October 11, 2002 8:42 PM
Subject: Re: FileNotFoundException while indexing


> Stas,
>
> Would you be able/willing to share that improved Directory with the list?
>
> Regards,
>
> Terry
>


Mime
View raw message