Author: szetszwo Date: Thu Mar 1 23:51:19 2012 New Revision: 1295999 URL: http://svn.apache.org/viewvc?rev=1295999&view=rev Log: HADOOP-8124, HDFS-3034, MAPREDUCE-3956. Remove the deprecated Syncable.sync().
Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataOutputStream.java hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1295999&r1=1295998&r2=1295999&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Thu Mar 1 23:51:19 2012 @@ -4,6 +4,9 @@ Trunk (unreleased changes) INCOMPATIBLE CHANGES + HADOOP-8124. Remove the deprecated FSDataOutputStream constructor, + FSDataOutputStream.sync() and Syncable.sync(). (szetszwo) + NEW FEATURES IMPROVEMENTS Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataOutputStream.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataOutputStream.java?rev=1295999&r1=1295998&r2=1295999&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataOutputStream.java (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSDataOutputStream.java Thu Mar 1 23:51:19 2012 @@ -17,7 +17,11 @@ */ package org.apache.hadoop.fs; -import java.io.*; +import java.io.BufferedOutputStream; +import java.io.DataOutputStream; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; @@ -28,20 +32,19 @@ import org.apache.hadoop.classification. @InterfaceAudience.Public @InterfaceStability.Stable public class FSDataOutputStream extends DataOutputStream implements Syncable { - private OutputStream wrappedStream; + private final OutputStream wrappedStream; private static class PositionCache extends FilterOutputStream { - private FileSystem.Statistics statistics; - long position; + private final FileSystem.Statistics statistics; + private long position; - public PositionCache(OutputStream out, - FileSystem.Statistics stats, - long pos) throws IOException { + PositionCache(OutputStream out, FileSystem.Statistics stats, long pos) { super(out); statistics = stats; position = pos; } + @Override public void write(int b) throws IOException { out.write(b); position++; @@ -50,6 +53,7 @@ public class FSDataOutputStream extends } } + @Override public void write(byte b[], int off, int len) throws IOException { out.write(b, off, len); position += len; // update position @@ -58,27 +62,22 @@ public class FSDataOutputStream extends } } - public long getPos() throws IOException { + long getPos() { return position; // return cached position } - + + @Override public void close() throws IOException { out.close(); } } - @Deprecated - public FSDataOutputStream(OutputStream out) throws IOException { - this(out, null); - } - - public FSDataOutputStream(OutputStream out, FileSystem.Statistics stats) - throws IOException { + public FSDataOutputStream(OutputStream out, FileSystem.Statistics stats) { this(out, stats, 0); } public FSDataOutputStream(OutputStream out, FileSystem.Statistics stats, - long startPosition) throws IOException { + long startPosition) { super(new PositionCache(out, stats, startPosition)); wrappedStream = out; } @@ -88,13 +87,14 @@ public class FSDataOutputStream extends * * @return the current position in the output stream */ - public long getPos() throws IOException { + public long getPos() { return ((PositionCache)out).getPos(); } /** * Close the underlying output stream. */ + @Override public void close() throws IOException { out.close(); // This invokes PositionCache.close() } @@ -110,14 +110,6 @@ public class FSDataOutputStream extends } @Override // Syncable - @Deprecated - public void sync() throws IOException { - if (wrappedStream instanceof Syncable) { - ((Syncable)wrappedStream).sync(); - } - } - - @Override // Syncable public void hflush() throws IOException { if (wrappedStream instanceof Syncable) { ((Syncable)wrappedStream).hflush(); Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java?rev=1295999&r1=1295998&r2=1295999&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Syncable.java Thu Mar 1 23:51:19 2012 @@ -27,11 +27,6 @@ import org.apache.hadoop.classification. @InterfaceAudience.Public @InterfaceStability.Evolving public interface Syncable { - /** - * @deprecated As of HADOOP 0.21.0, replaced by hflush - * @see #hflush() - */ - @Deprecated public void sync() throws IOException; /** Flush out the data in client's user buffer. After the return of * this call, new readers will see the data. Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java?rev=1295999&r1=1295998&r2=1295999&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java Thu Mar 1 23:51:19 2012 @@ -1196,7 +1196,7 @@ public class SequenceFile { /** flush all currently written data to the file system */ public void syncFs() throws IOException { if (out != null) { - out.sync(); // flush contents to file system + out.hflush(); // flush contents to file system } }