Index: contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
===================================================================
--- contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (revision 826405)
+++ contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (working copy)
@@ -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;
Index: contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
===================================================================
--- contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (revision 826405)
+++ contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (working copy)
@@ -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;
Index: src/java/org/apache/lucene/analysis/Analyzer.java
===================================================================
--- src/java/org/apache/lucene/analysis/Analyzer.java (revision 826405)
+++ src/java/org/apache/lucene/analysis/Analyzer.java (working copy)
@@ -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.
Index: src/java/org/apache/lucene/analysis/TokenStream.java
===================================================================
--- src/java/org/apache/lucene/analysis/TokenStream.java (revision 826405)
+++ src/java/org/apache/lucene/analysis/TokenStream.java (working copy)
@@ -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.
Index: src/java/org/apache/lucene/index/IndexReader.java
===================================================================
--- src/java/org/apache/lucene/index/IndexReader.java (revision 826405)
+++ src/java/org/apache/lucene/index/IndexReader.java (working copy)
@@ -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 @@
IndexReader 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
Index: src/java/org/apache/lucene/index/IndexWriter.java
===================================================================
--- src/java/org/apache/lucene/index/IndexWriter.java (revision 826527)
+++ src/java/org/apache/lucene/index/IndexWriter.java (working copy)
@@ -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).
Index: src/java/org/apache/lucene/index/MergePolicy.java
===================================================================
--- src/java/org/apache/lucene/index/MergePolicy.java (revision 826405)
+++ src/java/org/apache/lucene/index/MergePolicy.java (working copy)
@@ -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
Index: src/java/org/apache/lucene/index/TermDocs.java
===================================================================
--- src/java/org/apache/lucene/index/TermDocs.java (revision 826405)
+++ src/java/org/apache/lucene/index/TermDocs.java (working copy)
@@ -18,6 +18,7 @@
*/
import java.io.IOException;
+import java.io.Closeable;
/** TermDocs provides an interface for enumerating <document, frequency>
pairs for a term.
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. */ Index: src/java/org/apache/lucene/index/TermEnum.java =================================================================== --- src/java/org/apache/lucene/index/TermEnum.java (revision 826405) +++ src/java/org/apache/lucene/index/TermEnum.java (working copy) @@ -18,13 +18,14 @@ */ import java.io.IOException; +import java.io.Closeable; /** Abstract class for enumerating terms.
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;
Index: src/java/org/apache/lucene/search/Searchable.java
===================================================================
--- src/java/org/apache/lucene/search/Searchable.java (revision 826405)
+++ src/java/org/apache/lucene/search/Searchable.java (working copy)
@@ -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.
Index: src/java/org/apache/lucene/store/Directory.java
===================================================================
--- src/java/org/apache/lucene/store/Directory.java (revision 826405)
+++ src/java/org/apache/lucene/store/Directory.java (working copy)
@@ -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;
Index: src/java/org/apache/lucene/store/IndexInput.java
===================================================================
--- src/java/org/apache/lucene/store/IndexInput.java (revision 826405)
+++ src/java/org/apache/lucene/store/IndexInput.java (working copy)
@@ -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
Index: src/java/org/apache/lucene/store/IndexOutput.java
===================================================================
--- src/java/org/apache/lucene/store/IndexOutput.java (revision 826527)
+++ src/java/org/apache/lucene/store/IndexOutput.java (working copy)
@@ -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();
Index: src/java/org/apache/lucene/util/cache/Cache.java
===================================================================
--- src/java/org/apache/lucene/util/cache/Cache.java (revision 826527)
+++ src/java/org/apache/lucene/util/cache/Cache.java (working copy)
@@ -17,11 +17,12 @@
* limitations under the License.
*/
+import java.io.Closeable;
/**
* Base class for cache implementations.
*/
-public abstract class Cache