LUCENE-795: deprecate Directory.renameFile()

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@503911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2007-02-05 22:49:42 +00:00
parent 0149b5f82f
commit 55450e5b2c
4 changed files with 14 additions and 7 deletions

View File

@ -204,6 +204,9 @@ API Changes
remove an old lock. The default implementation is to ask the
lockFactory (if non null) to clear the lock. (Mike McCandless)
19. LUCENE-795: Directory.renameFile() has been deprecated as it is
not used anymore inside Lucene. (Daniel Naber)
Bug fixes
1. Fixed the web application demo (built with "ant war-demo") which

View File

@ -63,8 +63,10 @@ public abstract class Directory {
throws IOException;
/** Renames an existing file in the directory.
If a file already exists with the new name, then it is replaced.
This replacement should be atomic. */
* If a file already exists with the new name, then it is replaced.
* This replacement is not guaranteed to be atomic.
* @deprecated
*/
public abstract void renameFile(String from, String to)
throws IOException;

View File

@ -351,7 +351,10 @@ public class FSDirectory extends Directory {
throw new IOException("Cannot delete " + file);
}
/** Renames an existing file in the directory. */
/** Renames an existing file in the directory.
* Warning: This is not atomic.
* @deprecated
*/
public synchronized void renameFile(String from, String to)
throws IOException {
File old = new File(directory, from);

View File

@ -21,8 +21,6 @@ import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.File;
import java.io.Serializable;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
@ -185,8 +183,9 @@ public class RAMDirectory extends Directory implements Serializable {
throw new FileNotFoundException(name);
}
/** Removes an existing file in the directory.
* @throws IOException if from does not exist
/** Renames an existing file in the directory.
* @throws FileNotFoundException if from does not exist
* @deprecated
*/
public synchronized final void renameFile(String from, String to) throws IOException {
RAMFile fromFile = (RAMFile)fileMap.get(from);