You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/05/18 20:13:23 UTC

svn commit: r1124363 - in /lucene/dev/trunk/lucene: ./ contrib/db/bdb-je/src/java/org/apache/lucene/store/je/ contrib/db/bdb/src/java/org/apache/lucene/store/db/ contrib/misc/src/java/org/apache/lucene/store/ src/java/org/apache/lucene/index/ src/java/...

Author: mikemccand
Date: Wed May 18 18:13:23 2011
New Revision: 1124363

URL: http://svn.apache.org/viewvc?rev=1124363&view=rev
Log:
LUCENE-2027: remove Directory.touchFile

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/contrib/db/bdb-je/src/java/org/apache/lucene/store/je/JEDirectory.java
    lucene/dev/trunk/lucene/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java
    lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/NRTCachingDirectory.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/Directory.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FileSwitchDirectory.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMDirectory.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMFile.java
    lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Wed May 18 18:13:23 2011
@@ -530,6 +530,9 @@ API Changes
   ClassCastException when loading lazy fields or NumericFields.
   (Uwe Schindler, Ryan McKinley, Mike McCandless)
 
+* LUCENE-2027: Directory.touchFile is deprecated and will be removed
+  in 4.0.  (Mike McCandless)
+
 Optimizations
 
 * LUCENE-2990: ArrayUtil/CollectionUtil.*Sort() methods now exit early

Modified: lucene/dev/trunk/lucene/contrib/db/bdb-je/src/java/org/apache/lucene/store/je/JEDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/db/bdb-je/src/java/org/apache/lucene/store/je/JEDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/db/bdb-je/src/java/org/apache/lucene/store/je/JEDirectory.java (original)
+++ lucene/dev/trunk/lucene/contrib/db/bdb-je/src/java/org/apache/lucene/store/je/JEDirectory.java Wed May 18 18:13:23 2011
@@ -199,17 +199,6 @@ public class JEDirectory extends Directo
         return new JELock();
     }
 
-    @Override
-    public void touchFile(String name) throws IOException {
-        File file = new File(name);
-        long length = 0L;
-
-        if (file.exists(this))
-            length = file.getLength();
-
-        file.modify(this, length, System.currentTimeMillis());
-    }
-
     /**
      * Once a transaction handle was committed it is no longer valid. In order
      * to continue using this JEDirectory instance after a commit, the

Modified: lucene/dev/trunk/lucene/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java (original)
+++ lucene/dev/trunk/lucene/contrib/db/bdb/src/java/org/apache/lucene/store/db/DbDirectory.java Wed May 18 18:13:23 2011
@@ -222,19 +222,6 @@ public class DbDirectory extends Directo
         return new DbLock();
     }
 
-    @Override
-    public void touchFile(String name)
-        throws IOException
-    {
-        File file = new File(name);
-        long length = 0L;
-
-        if (file.exists(this))
-            length = file.getLength();
-
-        file.modify(this, length, System.currentTimeMillis());
-    }
-
     /**
      * Once a transaction handle was committed it is no longer valid. In
      * order to continue using this DbDirectory instance after a commit, the

Modified: lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/NRTCachingDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/NRTCachingDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/NRTCachingDirectory.java (original)
+++ lucene/dev/trunk/lucene/contrib/misc/src/java/org/apache/lucene/store/NRTCachingDirectory.java Wed May 18 18:13:23 2011
@@ -135,15 +135,6 @@ public class NRTCachingDirectory extends
   }
 
   @Override
-  public synchronized void touchFile(String name) throws IOException {
-    if (cache.fileExists(name)) {
-      cache.touchFile(name);
-    } else {
-      delegate.touchFile(name);
-    }
-  }
-
-  @Override
   public synchronized void deleteFile(String name) throws IOException {
     // Delete from both, in case we are currently uncaching:
     if (VERBOSE) {

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java Wed May 18 18:13:23 2011
@@ -189,12 +189,6 @@ public class CompoundFileReader extends 
         return directory.fileModified(fileName);
     }
 
-    /** Set the modified time of the compound file to now. */
-    @Override
-    public void touchFile(String name) throws IOException {
-        directory.touchFile(fileName);
-    }
-
     /** Not implemented
      * @throws UnsupportedOperationException */
     @Override

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/Directory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/Directory.java Wed May 18 18:13:23 2011
@@ -65,10 +65,6 @@ public abstract class Directory implemen
   public abstract long fileModified(String name)
        throws IOException;
 
-  /** Set the modified time of an existing file to now. */
-  public abstract void touchFile(String name)
-       throws IOException;
-
   /** Removes an existing file in the directory. */
   public abstract void deleteFile(String name)
        throws IOException;

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java Wed May 18 18:13:23 2011
@@ -272,14 +272,6 @@ public abstract class FSDirectory extend
     return file.lastModified();
   }
 
-  /** Set the modified time of an existing file to now. */
-  @Override
-  public void touchFile(String name) {
-    ensureOpen();
-    File file = new File(directory, name);
-    file.setLastModified(System.currentTimeMillis());
-  }
-
   /** Returns the length in bytes of a file in the directory. */
   @Override
   public long fileLength(String name) throws IOException {

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FileSwitchDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FileSwitchDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FileSwitchDirectory.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FileSwitchDirectory.java Wed May 18 18:13:23 2011
@@ -115,11 +115,6 @@ public class FileSwitchDirectory extends
   }
 
   @Override
-  public void touchFile(String name) throws IOException {
-    getDirectory(name).touchFile(name);
-  }
-
-  @Override
   public void deleteFile(String name) throws IOException {
     getDirectory(name).deleteFile(name);
   }

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMDirectory.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMDirectory.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMDirectory.java Wed May 18 18:13:23 2011
@@ -27,8 +27,6 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.lucene.util.ThreadInterruptedException;
-
 /**
  * A memory-resident {@link Directory} implementation.  Locking
  * implementation is by default the {@link SingleInstanceLockFactory}
@@ -112,30 +110,6 @@ public class RAMDirectory extends Direct
     return file.getLastModified();
   }
 
-  /** Set the modified time of an existing file to now.
-   * @throws IOException if the file does not exist
-   */
-  @Override
-  public void touchFile(String name) throws IOException {
-    ensureOpen();
-    RAMFile file = fileMap.get(name);
-    if (file == null) {
-      throw new FileNotFoundException(name);
-    }
-    
-    long ts2, ts1 = System.currentTimeMillis();
-    do {
-      try {
-        Thread.sleep(0, 1);
-      } catch (InterruptedException ie) {
-        throw new ThreadInterruptedException(ie);
-      }
-      ts2 = System.currentTimeMillis();
-    } while(ts1 == ts2);
-    
-    file.setLastModified(ts2);
-  }
-
   /** Returns the length in bytes of a file in the directory.
    * @throws IOException if the file does not exist
    */

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMFile.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMFile.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMFile.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/RAMFile.java Wed May 18 18:13:23 2011
@@ -26,7 +26,6 @@ public class RAMFile {
   RAMDirectory directory;
   protected long sizeInBytes;
 
-  // This is publicly modifiable via Directory.touchFile(), so direct access not supported
   private long lastModified = System.currentTimeMillis();
 
   // File used as buffer, in no RAMDirectory

Modified: lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java (original)
+++ lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java Wed May 18 18:13:23 2011
@@ -560,12 +560,6 @@ public class MockDirectoryWrapper extend
   }
 
   @Override
-  public synchronized void touchFile(String name) throws IOException {
-    maybeYield();
-    delegate.touchFile(name);
-  }
-
-  @Override
   public synchronized long fileLength(String name) throws IOException {
     maybeYield();
     return delegate.fileLength(name);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java Wed May 18 18:13:23 2011
@@ -411,10 +411,6 @@ public class TestFieldsReader extends Lu
       return fsDir.fileModified(name);
     }
     @Override
-    public void touchFile(String name) throws IOException {
-      fsDir.touchFile(name);
-    }
-    @Override
     public void deleteFile(String name) throws IOException {
       fsDir.deleteFile(name);
     }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java?rev=1124363&r1=1124362&r2=1124363&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java Wed May 18 18:13:23 2011
@@ -345,12 +345,6 @@ public class TestBufferedIndexInput exte
         dir.deleteFile(name);
       }
       @Override
-      public void touchFile(String name)
-        throws IOException
-      {
-        dir.touchFile(name);
-      }
-      @Override
       public long fileModified(String name)
         throws IOException
       {