hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x...@apache.org
Subject hadoop git commit: HDDS-416. Remove currentPosition from ChunkInputStreamEntry. Contributed by Lokesh Jain.
Date Tue, 11 Sep 2018 22:32:57 GMT
Repository: hadoop
Updated Branches:
  refs/heads/ozone-0.2.1 ccbee90ce -> 4ef06ea23


HDDS-416. Remove currentPosition from ChunkInputStreamEntry. Contributed by Lokesh Jain.

(cherry picked from commit 1d567c25d0c97603f35ab5c789217df8ec6893d7)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4ef06ea2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4ef06ea2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4ef06ea2

Branch: refs/heads/ozone-0.2.1
Commit: 4ef06ea236482a6bffe42b1cfc2d0ff1858a572a
Parents: ccbee90
Author: Xiaoyu Yao <xyao@HW14116.local>
Authored: Tue Sep 11 15:12:59 2018 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Tue Sep 11 15:31:26 2018 -0700

----------------------------------------------------------------------
 .../hadoop/ozone/client/io/ChunkGroupInputStream.java     | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4ef06ea2/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java
index 9283f19..742cfcc 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java
@@ -71,7 +71,7 @@ public class ChunkGroupInputStream extends InputStream implements Seekable
{
   }
 
   @VisibleForTesting
-  public long getRemainingOfIndex(int index) {
+  public long getRemainingOfIndex(int index) throws IOException {
     return streamEntries.get(index).getRemaining();
   }
 
@@ -206,31 +206,27 @@ public class ChunkGroupInputStream extends InputStream implements Seekable
{
 
     private final ChunkInputStream chunkInputStream;
     private final long length;
-    private long currentPosition;
 
     public ChunkInputStreamEntry(ChunkInputStream chunkInputStream,
         long length) {
       this.chunkInputStream = chunkInputStream;
       this.length = length;
-      this.currentPosition = 0;
     }
 
-    synchronized long getRemaining() {
-      return length - currentPosition;
+    synchronized long getRemaining() throws IOException {
+      return length - getPos();
     }
 
     @Override
     public synchronized int read(byte[] b, int off, int len)
         throws IOException {
       int readLen = chunkInputStream.read(b, off, len);
-      currentPosition += readLen;
       return readLen;
     }
 
     @Override
     public synchronized int read() throws IOException {
       int data = chunkInputStream.read();
-      currentPosition += 1;
       return data;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message