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 HDFS-7805. NameNode recovery prompt should be printed on console (Surendra
Singh Lilhore via Colin P. McCabe) 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 BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
HDFS-7720. Quota by Storage Type API, tools and ClientNameNode HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

View File

@ -1496,11 +1496,11 @@ public class DFSAdmin extends FsShell {
RPC.getProxy(xface, RPC.getProtocolVersion(xface), address, RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
ugi, conf, NetUtils.getDefaultSocketFactory(conf), 0); ugi, conf, NetUtils.getDefaultSocketFactory(conf), 0);
GenericRefreshProtocol xlator = Collection<RefreshResponse> responses = null;
new GenericRefreshProtocolClientSideTranslatorPB(proxy); try (GenericRefreshProtocolClientSideTranslatorPB xlator =
new GenericRefreshProtocolClientSideTranslatorPB(proxy);) {
// Refresh // Refresh
Collection<RefreshResponse> responses = xlator.refresh(identifier, args); responses = xlator.refresh(identifier, args);
int returnCode = 0; int returnCode = 0;
@ -1515,11 +1515,16 @@ public class DFSAdmin extends FsShell {
} else if (returnCode != 0 && response.getReturnCode() != 0) { } else if (returnCode != 0 && response.getReturnCode() != 0) {
// Then now we have multiple non-zero return codes, // Then now we have multiple non-zero return codes,
// so we merge them into -1 // so we merge them into -1
returnCode = -1; returnCode = - 1;
} }
} }
return returnCode; return returnCode;
} finally {
if (responses == null) {
System.out.println("Failed to get response.\n");
return -1;
}
}
} }
/** /**