This is an automated email from the ASF dual-hosted git repository.
jeagles pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/tez.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new d6978fe TEZ-4268: Buffer File Read of TEZ AM Local Resources PB File
(#91)
d6978fe is described below
commit d6978fe16bce68872a21934c7c72e8c5fb38758d
Author: belugabehr <[email protected]>
AuthorDate: Mon Jan 25 17:44:11 2021 -0500
TEZ-4268: Buffer File Read of TEZ AM Local Resources PB File (#91)
(cherry picked from commit 7374b69ed6c4af4e7c9127f1b05473c2166abf6d)
---
.../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 2760be6..92a4d40 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;
@@ -608,17 +609,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));
}
}
}