You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by je...@apache.org on 2021/01/25 22:44:36 UTC

[tez] branch master updated: TEZ-4268: Buffer File Read of TEZ AM Local Resources PB File (#91)

This is an automated email from the ASF dual-hosted git repository.

jeagles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/master by this push:
     new 7374b69  TEZ-4268: Buffer File Read of TEZ AM Local Resources PB File (#91)
7374b69 is described below

commit 7374b69ed6c4af4e7c9127f1b05473c2166abf6d
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Mon Jan 25 17:44:11 2021 -0500

    TEZ-4268: Buffer File Read of TEZ AM Local Resources PB File (#91)
---
 .../main/java/org/apache/tez/dag/app/DAGAppMaster.java   | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index cde77b3..ba072a9 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -20,6 +20,7 @@ package org.apache.tez.dag.app;
 
 
 
+import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -604,17 +605,14 @@ public class DAGAppMaster extends AbstractService {
 
     if (!versionMismatch) {
       if (isSession) {
-        FileInputStream sessionResourcesStream = null;
-        try {
-          sessionResourcesStream = new FileInputStream(
-              new File(workingDirectory, TezConstants.TEZ_AM_LOCAL_RESOURCES_PB_FILE_NAME));
+        try (BufferedInputStream sessionResourcesStream =
+            new BufferedInputStream(
+                new FileInputStream(new File(workingDirectory,
+                    TezConstants.TEZ_AM_LOCAL_RESOURCES_PB_FILE_NAME)))) {
           PlanLocalResourcesProto amLocalResourceProto = PlanLocalResourcesProto
               .parseDelimitedFrom(sessionResourcesStream);
-          amResources.putAll(DagTypeConverters.convertFromPlanLocalResources(amLocalResourceProto));
-        } finally {
-          if (sessionResourcesStream != null) {
-            sessionResourcesStream.close();
-          }
+          amResources.putAll(DagTypeConverters
+              .convertFromPlanLocalResources(amLocalResourceProto));
         }
       }
     }