lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r826540 - in /lucene/java/trunk: contrib/instantiated/src/java/org/apache/lucene/store/instantiated/ src/java/org/apache/lucene/analysis/ src/java/org/apache/lucene/index/ src/java/org/apache/lucene/search/ src/java/org/apache/lucene/store/...
Date Sun, 18 Oct 2009 22:21:44 GMT
Author: uschindler
Date: Sun Oct 18 22:21:43 2009
New Revision: 826540

URL: http://svn.apache.org/viewvc?rev=826540&view=rev
Log:
LUCENE-1945: Add Closeable interface to all public interfaces/super-classes that define close().
Package-private classes inside oal.index are not changed (as they often only define package-private
close()) 

Modified:
    lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
    lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/analysis/Analyzer.java
    lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java
    lucene/java/trunk/src/java/org/apache/lucene/index/TermDocs.java
    lucene/java/trunk/src/java/org/apache/lucene/index/TermEnum.java
    lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java
    lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java
    lucene/java/trunk/src/java/org/apache/lucene/store/IndexInput.java
    lucene/java/trunk/src/java/org/apache/lucene/store/IndexOutput.java
    lucene/java/trunk/src/java/org/apache/lucene/util/CloseableThreadLocal.java
    lucene/java/trunk/src/java/org/apache/lucene/util/cache/Cache.java

Modified: lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
(original)
+++ lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
Sun Oct 18 22:21:43 2009
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -52,7 +53,7 @@
  * Consider using InstantiatedIndex as if it was immutable.
  */
 public class InstantiatedIndex
-    implements Serializable {
+    implements Serializable,Closeable {
 
   private static final long serialVersionUID = 1l;
 

Modified: lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
(original)
+++ lucene/java/trunk/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
Sun Oct 18 22:21:43 2009
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.io.StringReader;
+import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -58,7 +59,7 @@
  *
  * @see org.apache.lucene.index.IndexWriter 
  */
-public class InstantiatedIndexWriter {
+public class InstantiatedIndexWriter implements Closeable {
 
   private PrintStream infoStream = null;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/Analyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/Analyzer.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/Analyzer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/Analyzer.java Sun Oct 18 22:21:43
2009
@@ -19,6 +19,7 @@
 
 import java.io.Reader;
 import java.io.IOException;
+import java.io.Closeable;
 import java.lang.reflect.Method;
 
 import org.apache.lucene.util.CloseableThreadLocal;
@@ -33,7 +34,7 @@
  *  characters from the Reader into raw Tokens.  One or more TokenFilters may
  *  then be applied to the output of the Tokenizer.
  */
-public abstract class Analyzer {
+public abstract class Analyzer implements Closeable {
   /** Creates a TokenStream which tokenizes all the text in the provided
    * Reader.  Must be able to handle null field name for
    * backward compatibility.

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/TokenStream.java Sun Oct 18 22:21:43
2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -76,7 +77,7 @@
  * {@link AttributeSource#captureState} and {@link AttributeSource#restoreState}
  * can be used.
  */
-public abstract class TokenStream extends AttributeSource {
+public abstract class TokenStream extends AttributeSource implements Closeable {
 
   /**
    * A TokenStream using the default attribute factory.

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java Sun Oct 18 22:21:43
2009
@@ -25,6 +25,7 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.Closeable;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
@@ -75,7 +76,7 @@
  <code>IndexReader</code> instance; use your own
  (non-Lucene) objects instead.
 */
-public abstract class IndexReader implements Cloneable {
+public abstract class IndexReader implements Cloneable,Closeable {
 
   /**
    * Constants describing field properties, for example used for

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Sun Oct 18 22:21:43
2009
@@ -30,6 +30,7 @@
 import org.apache.lucene.util.Constants;
 
 import java.io.IOException;
+import java.io.Closeable;
 import java.io.PrintStream;
 import java.util.List;
 import java.util.Collection;
@@ -165,7 +166,7 @@
  * referenced by the "front" of the index). For this, IndexFileDeleter 
  * keeps track of the last non commit checkpoint.
  */
-public class IndexWriter {
+public class IndexWriter implements Closeable {
 
   /**
    * Default value for the write lock timeout (1,000).

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java Sun Oct 18 22:21:43
2009
@@ -61,7 +61,7 @@
  * these APIs.
  */
 
-public abstract class MergePolicy {
+public abstract class MergePolicy implements java.io.Closeable {
 
   /** OneMerge provides the information necessary to perform
    *  an individual primitive merge operation, resulting in

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/TermDocs.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/TermDocs.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/TermDocs.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/TermDocs.java Sun Oct 18 22:21:43 2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 
 /** TermDocs provides an interface for enumerating &lt;document, frequency&gt;
  pairs for a term.  <p> The document portion names each document containing
@@ -28,7 +29,7 @@
  @see IndexReader#termDocs()
  */
 
-public interface TermDocs {
+public interface TermDocs extends Closeable {
   /** Sets this to the data for a term.
    * The enumeration is reset to the start of the data for this term.
    */

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/TermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/TermEnum.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/TermEnum.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/TermEnum.java Sun Oct 18 22:21:43 2009
@@ -18,13 +18,14 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 
 /** Abstract class for enumerating terms.
 
   <p>Term enumerations are always ordered by Term.compareTo().  Each term in
   the enumeration is greater than all that precede it.  */
 
-public abstract class TermEnum {
+public abstract class TermEnum implements Closeable {
   /** Increments the enumeration to the next element.  True if one exists.*/
   public abstract boolean next() throws IOException;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Searchable.java Sun Oct 18 22:21:43
2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.FieldSelector;
@@ -41,7 +42,7 @@
  * expected to be implemented directly, it may be changed unexpectedly between
  * releases.
  */
-public interface Searchable {
+public interface Searchable extends Closeable {
   
   /**
    * Lower-level search API.

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/Directory.java Sun Oct 18 22:21:43
2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 
 import org.apache.lucene.index.IndexFileNameFilter;
 
@@ -37,7 +38,7 @@
  * instance using {@link #setLockFactory}.
  *
  */
-public abstract class Directory {
+public abstract class Directory implements Closeable {
 
   volatile protected boolean isOpen = true;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/IndexInput.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/IndexInput.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/IndexInput.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/IndexInput.java Sun Oct 18 22:21:43
2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -25,7 +26,7 @@
  * random-access input stream.  Used for all Lucene index input operations.
  * @see Directory
  */
-public abstract class IndexInput implements Cloneable {
+public abstract class IndexInput implements Cloneable,Closeable {
   private byte[] bytes;                           // used by readString()
   private char[] chars;                           // used by readModifiedUTF8String()
   private boolean preUTF8Strings;                 // true if we are reading old (modified
UTF8) string format

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/IndexOutput.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/IndexOutput.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/IndexOutput.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/IndexOutput.java Sun Oct 18 22:21:43
2009
@@ -18,6 +18,7 @@
  */
 
 import java.io.IOException;
+import java.io.Closeable;
 import java.util.Map;
 import org.apache.lucene.util.UnicodeUtil;
 
@@ -26,7 +27,7 @@
  * @see Directory
  * @see IndexInput
  */
-public abstract class IndexOutput {
+public abstract class IndexOutput implements Closeable {
 
   private UnicodeUtil.UTF8Result utf8Result = new UnicodeUtil.UTF8Result();
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/util/CloseableThreadLocal.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/CloseableThreadLocal.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/CloseableThreadLocal.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/CloseableThreadLocal.java Sun Oct 18
22:21:43 2009
@@ -21,6 +21,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.lang.ref.WeakReference;
+import java.io.Closeable;
 
 /** Java's builtin ThreadLocal has a serious flaw:
  *  it can take an arbitrarily long amount of time to
@@ -42,7 +43,7 @@
  *  references are cleared and then GC is freely able to
  *  reclaim space by objects stored in it. */
 
-public class CloseableThreadLocal<T> {
+public class CloseableThreadLocal<T> implements Closeable {
 
   private ThreadLocal<WeakReference<T>> t = new ThreadLocal<WeakReference<T>>();
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/util/cache/Cache.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/cache/Cache.java?rev=826540&r1=826539&r2=826540&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/cache/Cache.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/cache/Cache.java Sun Oct 18 22:21:43
2009
@@ -17,11 +17,12 @@
  * limitations under the License.
  */
 
+import java.io.Closeable;
 
 /**
  * Base class for cache implementations.
  */
-public abstract class Cache<K,V> {
+public abstract class Cache<K,V> implements Closeable {
   
   /**
    * Simple Cache wrapper that synchronizes all



Mime
View raw message