Repository: tez
Updated Branches:
  refs/heads/master e41699119 -> 0c7e1c5bb


TEZ-3192. IFile#checkState creating unnecessary objects though auto-boxing 
(jeagles)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/0c7e1c5b
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/0c7e1c5b
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/0c7e1c5b

Branch: refs/heads/master
Commit: 0c7e1c5bb252f2a2631457adad3ebf29c23425e2
Parents: e416991
Author: Jonathan Eagles <[email protected]>
Authored: Thu Mar 31 19:15:58 2016 -0500
Committer: Jonathan Eagles <[email protected]>
Committed: Thu Mar 31 19:16:03 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../runtime/library/common/sort/impl/IFile.java | 23 ++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/0c7e1c5b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 70901e0..3272638 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES
   TEZ-3029. Add an onError method to service plugin contexts.
 
 ALL CHANGES:
+  TEZ-3192. IFile#checkState creating unnecessary objects though auto-boxing
   TEZ-3173. Update Tez AM REST APIs for more information for each vertex.
   TEZ-3108. Add support for external services to local mode.
   TEZ-3189. Pre-warm dags should not be counted in submitted dags count by 
DAGAppMaster.
@@ -411,6 +412,7 @@ INCOMPATIBLE CHANGES
   TEZ-2949. Allow duplicate dag names within session for Tez.
 
 ALL CHANGES:
+  TEZ-3192. IFile#checkState creating unnecessary objects though auto-boxing
   TEZ-3189. Pre-warm dags should not be counted in submitted dags count by 
DAGAppMaster.
   TEZ-2967. Vertex start time should be that of first task start time in UI
   TEZ-3175. Add tez client submit host

http://git-wip-us.apache.org/repos/asf/tez/blob/0c7e1c5b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/IFile.java
----------------------------------------------------------------------
diff --git 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/IFile.java
 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/IFile.java
index a99eb5e..6d8992e 100644
--- 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/IFile.java
+++ 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/IFile.java
@@ -192,7 +192,9 @@ public class IFile {
     }
 
     public void close() throws IOException {
-      checkState(!closed.getAndSet(true), "Writer was already closed earlier");
+      if (closed.getAndSet(true)) {
+        throw new IOException("Writer was already closed earlier");
+      }
 
       // When IFile writer is created by BackupStore, we do not have
       // Key and Value classes set. So, check before closing the
@@ -703,7 +705,9 @@ public class IFile {
      */
     protected boolean positionToNextRecord(DataInput dIn) throws IOException {
       // Sanity check
-      checkState(!eof, "Reached EOF. Completed reading %d", bytesRead);
+      if (eof) {
+        throw new IOException(String.format("Reached EOF. Completed reading 
%d", bytesRead));
+      }
       prevKeyLength = currentKeyLength;
 
       if (prevKeyLength == RLE_MARKER) {
@@ -754,7 +758,9 @@ public class IFile {
         keyBytes = new byte[currentKeyLength << 1];
       }
       int i = readData(keyBytes, 0, currentKeyLength);
-      checkState((i == currentKeyLength), INCOMPLETE_READ, currentKeyLength, 
i);
+      if (i != currentKeyLength) {
+        throw new IOException(String.format(INCOMPLETE_READ, currentKeyLength, 
i));
+      }
       key.reset(keyBytes, currentKeyLength);
       bytesRead += currentKeyLength;
       return KeyState.NEW_KEY;
@@ -766,7 +772,9 @@ public class IFile {
         ? new byte[currentValueLength << 1]
         : value.getData();
       int i = readData(valBytes, 0, currentValueLength);
-      checkState((i == currentValueLength), INCOMPLETE_READ, 
currentValueLength, i);
+      if (i != currentValueLength) {
+        throw new IOException(String.format(INCOMPLETE_READ, 
currentValueLength, i));
+      }
       value.reset(valBytes, currentValueLength);
 
       // Record the bytes read
@@ -819,11 +827,4 @@ public class IFile {
     }
   }
 
-  public static void checkState(boolean expression, String format,
-      Object... args) throws IOException {
-    if (!expression) {
-      throw new IOException(String.format(format, args));
-    }
-  }
-
 }

Reply via email to