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

(cherry picked from commit 14a696f369f7e3802587f57c8fff3aa51b5ab576)
(cherry picked from commit 74f2df16a919711cbd10464d11851110c1728edf)
This commit is contained in:
Akira Ajisaka 2016-09-26 15:00:01 +09:00
parent 4c2b20ca3e
commit ece3ca0cba

View File

@ -761,17 +761,14 @@ protected synchronized void storeRMDTMasterKeyState(
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();
}
}