hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: YARN-5663. Small refactor in ZKRMStateStore. Contributed by Oleksii Dymytrov.
Date Mon, 26 Sep 2016 06:01:24 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 eec0afa09 -> 74f2df16a


YARN-5663. Small refactor in ZKRMStateStore. Contributed by Oleksii Dymytrov.

(cherry picked from commit 14a696f369f7e3802587f57c8fff3aa51b5ab576)


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

Branch: refs/heads/branch-2
Commit: 74f2df16a919711cbd10464d11851110c1728edf
Parents: eec0afa
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Mon Sep 26 15:00:01 2016 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Mon Sep 26 15:01:13 2016 +0900

----------------------------------------------------------------------
 .../server/resourcemanager/recovery/ZKRMStateStore.java     | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/74f2df16/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
index 9e05f6d..c24b3e9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKRMStateStore.java
@@ -748,17 +748,14 @@ public class ZKRMStateStore extends RMStateStore {
     String nodeCreatePath =
         getNodePath(dtMasterKeysRootPath, DELEGATION_KEY_PREFIX
             + delegationKey.getKeyId());
-    ByteArrayOutputStream os = new ByteArrayOutputStream();
-    DataOutputStream fsOut = new DataOutputStream(os);
     if (LOG.isDebugEnabled()) {
       LOG.debug("Storing RMDelegationKey_" + delegationKey.getKeyId());
     }
-    delegationKey.write(fsOut);
-    try {
+    ByteArrayOutputStream os = new ByteArrayOutputStream();
+    try(DataOutputStream fsOut = new DataOutputStream(os)) {
+      delegationKey.write(fsOut);
       safeCreate(nodeCreatePath, os.toByteArray(), zkAcl,
           CreateMode.PERSISTENT);
-    } finally {
-      os.close();
     }
   }
 


---------------------------------------------------------------------
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