lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Isakson" <>
Subject RE: IndexReader.lastModified(); (moved from the User list)
Date Tue, 06 May 2003 13:48:19 GMT
Could this be fixed by adding a conditional sleep in this block of code from IndexWriter. You
would use this by setting the System property "org.apache.lucene.SleepOnIndexCreate" to an
int value in milliseconds of how long to sleep when creating a new index. I've attached a
patch. I don't have a linux system to try this out on, perhaps Rob could apply this patch
and see if it fixes his problem.

  public IndexWriter(Directory d, Analyzer a, final boolean create)
       throws IOException {
    directory = d;
    analyzer = a;

    Lock writeLock = directory.makeLock("write.lock");
    if (!writeLock.obtain())                      // obtain write lock
      throw new IOException("Index locked for write: " + writeLock);
    this.writeLock = writeLock;                   // save it

    synchronized (directory) {			  // in- & inter-process sync
      new Lock.With(directory.makeLock("commit.lock")) {
	  public Object doBody() throws IOException {
	    if (create) {
			String sleepOnCreate =
			if (sleepOnCreate != null) {
				try {
					int sleepTime = Integer.parseInt(sleepOnCreate);
				} catch (NumberFormatException e) {
				} catch (InterruptedException e) {
	    return null;

Eric D. Isakson        SAS Institute Inc.
Application Developer  SAS Campus Drive
XML Technologies       Cary, NC 27513
(919) 531-3639

-----Original Message-----
From: Tatu Saloranta [] 
Sent: Tuesday, May 06, 2003 9:06 AM
To: Lucene Users List
Subject: Re: IndexReader.lastModified();

On Tuesday 06 May 2003 05:42, Rob Outar wrote:
> Yeah it looks like I am going to have to handle it internally instead 
> of relying on IndexReader.lastModified(), oh well so much for 
> cross-platform-ism :-)

[regarding ext2-fs 'feature' on Linux]

I think this 'feature' might be useful thing to document in a FAQ. Perhaps 
there should be a platform-dependancies FAQ (or sub-section). Wasn't there 
also some concern regarding Windows platform, where deleted status of a file was not reliably
accessed by Java (or something similar)?

Also, do you think ext3 has same problem? (or if it has, other new journaling 
file systems).

-+ Tatu +-

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message