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

This commit is contained in:
Akira Ajisaka 2016-09-26 15:00:01 +09:00
parent 5707f88d85
commit 14a696f369
1 changed files with 3 additions and 6 deletions

View File

@ -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());
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
try(DataOutputStream fsOut = new DataOutputStream(os)) {
delegationKey.write(fsOut);
try {
safeCreate(nodeCreatePath, os.toByteArray(), zkAcl,
CreateMode.PERSISTENT);
} finally {
os.close();
}
}