Skip to content

Commit 730ea24

Browse files
author
slfan1989
committed
YARN-11180. Fix CheckStyle.
1 parent 07a9043 commit 730ea24

File tree

1 file changed

+3
-6
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm

1 file changed

+3
-6
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/FederationClientInterceptor.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ protected ApplicationClientProtocol getClientRMProxyForSubCluster(
250250

251251
private SubClusterId getRandomActiveSubCluster(
252252
Map<SubClusterId, SubClusterInfo> activeSubClusters) throws YarnException {
253-
if (activeSubClusters.isEmpty()) {
253+
if (activeSubClusters != null && activeSubClusters.isEmpty()) {
254254
RouterServerUtil.logAndThrowException(
255255
FederationPolicyUtils.NO_ACTIVE_SUBCLUSTER_AVAILABLE, null);
256256
}
@@ -291,13 +291,11 @@ public GetNewApplicationResponse getNewApplication(
291291
Map<SubClusterId, SubClusterInfo> subClustersActive =
292292
federationFacade.getSubClusters(true);
293293

294-
GetNewApplicationResponse response = null;
295-
296294
for (int i = 0; i < numSubmitRetries; ++i) {
297295
SubClusterId subClusterId = getRandomActiveSubCluster(subClustersActive);
298296
LOG.info("getNewApplication try #{} on SubCluster {}.", i, subClusterId);
299297
ApplicationClientProtocol clientRMProxy = getClientRMProxyForSubCluster(subClusterId);
300-
response = null;
298+
GetNewApplicationResponse response = null;
301299
try {
302300
response = clientRMProxy.getNewApplication(request);
303301
} catch (Exception e) {
@@ -489,8 +487,7 @@ public SubmitApplicationResponse submitApplication(
489487
request.getApplicationSubmissionContext().getApplicationName(), applicationId);
490488
RouterAuditLogger.logFailure(user.getShortUserName(), SUBMIT_NEW_APP, UNKNOWN,
491489
TARGET_CLIENT_RM_SERVICE, msg, applicationId);
492-
RouterServerUtil.logAndThrowException(msg, null);
493-
return response;
490+
throw new YarnException(msg);
494491
}
495492

496493
/**

0 commit comments

Comments
 (0)