YARN-5663. Small refactor in ZKRMStateStore. Contributed by Oleksii Dymytrov.
This commit is contained in:
parent
5707f88d85
commit
14a696f369
|
@ -748,17 +748,14 @@ public class ZKRMStateStore extends RMStateStore {
|
||||||
String nodeCreatePath =
|
String nodeCreatePath =
|
||||||
getNodePath(dtMasterKeysRootPath, DELEGATION_KEY_PREFIX
|
getNodePath(dtMasterKeysRootPath, DELEGATION_KEY_PREFIX
|
||||||
+ delegationKey.getKeyId());
|
+ delegationKey.getKeyId());
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
||||||
DataOutputStream fsOut = new DataOutputStream(os);
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Storing RMDelegationKey_" + delegationKey.getKeyId());
|
LOG.debug("Storing RMDelegationKey_" + delegationKey.getKeyId());
|
||||||
}
|
}
|
||||||
delegationKey.write(fsOut);
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
try {
|
try(DataOutputStream fsOut = new DataOutputStream(os)) {
|
||||||
|
delegationKey.write(fsOut);
|
||||||
safeCreate(nodeCreatePath, os.toByteArray(), zkAcl,
|
safeCreate(nodeCreatePath, os.toByteArray(), zkAcl,
|
||||||
CreateMode.PERSISTENT);
|
CreateMode.PERSISTENT);
|
||||||
} finally {
|
|
||||||
os.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue