瀏覽代碼

Move Closeable interface to io package, since it is of general utility, and to prepare for JDK 1.5.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@378043 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 年之前
父節點
當前提交
2f5f4afbee

+ 6 - 2
src/java/org/apache/hadoop/mapred/Closeable.java → src/java/org/apache/hadoop/io/Closeable.java

@@ -14,11 +14,15 @@
  * limitations under the License.
  */
 
-package org.apache.hadoop.mapred;
+package org.apache.hadoop.io;
+
+import java.io.IOException;
+
+// NOTE: Replace with java.io.Closeable when we upgrade to Java 1.5.
 
 /** That which can be closed. */
 public interface Closeable {
   /** Called after the last call to any other method on this object to free
    * and/or flush resources.  Typical implementations do nothing. */
-  void close();
+  void close() throws IOException;
 }

+ 3 - 4
src/java/org/apache/hadoop/mapred/CombiningCollector.java

@@ -78,9 +78,8 @@ class CombiningCollector implements OutputCollector {
     count = 0;
   }
   
-  public synchronized void close() 
-  { 
-	  combiner.close(); 
-  } 
+  public synchronized void close() throws IOException { 
+    combiner.close(); 
+  }
 
 }

+ 1 - 0
src/java/org/apache/hadoop/mapred/Mapper.java

@@ -18,6 +18,7 @@ package org.apache.hadoop.mapred;
 
 import java.io.IOException;
 
+import org.apache.hadoop.io.Closeable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 

+ 1 - 1
src/java/org/apache/hadoop/mapred/ReduceTask.java

@@ -285,7 +285,7 @@ class ReduceTask extends Task {
       }
 
     } finally {
-    	reducer.close();
+      reducer.close();
       in.close();
       lfs.delete(new File(sortedFile));           // remove sorted
       out.close(reporter);

+ 1 - 0
src/java/org/apache/hadoop/mapred/Reducer.java

@@ -20,6 +20,7 @@ import java.io.IOException;
 
 import java.util.Iterator;
 
+import org.apache.hadoop.io.Closeable;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;