HDFS-7008. xlator should be closed upon exit from DFSAdmin#genericRefresh(). (ozawa)

This commit is contained in:
Tsuyoshi Ozawa 2015-02-24 23:59:34 +09:00
parent b610c68d44
commit b53fd7163b
2 changed files with 27 additions and 19 deletions

View File

@ -1014,6 +1014,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7805. NameNode recovery prompt should be printed on console (Surendra
Singh Lilhore via Colin P. McCabe)
HDFS-7008. xlator should be closed upon exit from DFSAdmin#genericRefresh().
(ozawa)
BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

View File

@ -1496,30 +1496,35 @@ public int genericRefresh(String[] argv, int i) throws IOException {
RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
ugi, conf, NetUtils.getDefaultSocketFactory(conf), 0);
GenericRefreshProtocol xlator =
new GenericRefreshProtocolClientSideTranslatorPB(proxy);
Collection<RefreshResponse> responses = null;
try (GenericRefreshProtocolClientSideTranslatorPB xlator =
new GenericRefreshProtocolClientSideTranslatorPB(proxy);) {
// Refresh
responses = xlator.refresh(identifier, args);
// Refresh
Collection<RefreshResponse> responses = xlator.refresh(identifier, args);
int returnCode = 0;
int returnCode = 0;
// Print refresh responses
System.out.println("Refresh Responses:\n");
for (RefreshResponse response : responses) {
System.out.println(response.toString());
// Print refresh responses
System.out.println("Refresh Responses:\n");
for (RefreshResponse response : responses) {
System.out.println(response.toString());
if (returnCode == 0 && response.getReturnCode() != 0) {
// This is the first non-zero return code, so we should return this
returnCode = response.getReturnCode();
} else if (returnCode != 0 && response.getReturnCode() != 0) {
// Then now we have multiple non-zero return codes,
// so we merge them into -1
returnCode = -1;
if (returnCode == 0 && response.getReturnCode() != 0) {
// This is the first non-zero return code, so we should return this
returnCode = response.getReturnCode();
} else if (returnCode != 0 && response.getReturnCode() != 0) {
// Then now we have multiple non-zero return codes,
// so we merge them into -1
returnCode = - 1;
}
}
return returnCode;
} finally {
if (responses == null) {
System.out.println("Failed to get response.\n");
return -1;
}
}
return returnCode;
}
/**