lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Tucker" <m...@jivesoftware.com>
Subject RE: FSDirectory patch for file renaming
Date Tue, 18 Feb 2003 22:59:22 GMT
Personally, I tried every hack I could in the past to make File.renameTo
work completely reliably, and could never quite do it. I even resorted
to trying things like calling File.renameTo up to three times in a row
with a 50 ms pause in between each call. At the end of the day, the only
truly reliable solution I could come up with was to manually copy the
contents of one file from one place to another.

Regards,
Matt

> -----Original Message-----
> From: petite_abeille [mailto:petite_abeille@mac.com] 
> Sent: Tuesday, February 18, 2003 5:13 PM
> To: Lucene Developers List
> Subject: Re: FSDirectory patch for file renaming
> 
> 
> 
> On Tuesday, Feb 18, 2003, at 22:59 Europe/Zurich, Matt Tucker wrote:
> 
> > I believe that's the current logic used by FSDirectory, and 
> it still 
> > breaks.
> 
> I see... deleting an non-existent file before a rename 
> usually does the 
> trick under the different Windows flavors...
> 
> If the destination file exists in the first place... have you 
> tried to 
> simply recreate the File object after the first delete if the 
> file did 
> exists? Something like:
> 
> // aDestinationFile exists in this case... get ride of it...
> 
> aDestinationFile.delete();
> 
> // FIXME: Hack to flush something, somewhere in the vm... sigh...
> 
> aDestinationFile = null;
> aDestinationFile = new File( aPath ); aDestinationFile.delete();
> 
> // Finally do the rename...
> 
> aSourceFile.renameTo( aDestinationFile );
> 
> PA.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message