@@ -1172,7 +1172,6 @@ public ApplicationStatisticsInfo getAppStatistics(HttpServletRequest hsr,
11721172 @ Override
11731173 public NodeToLabelsInfo getNodeToLabels (HttpServletRequest hsr )
11741174 throws IOException {
1175- NodeToLabelsInfo nodeToLabelsInfo ;
11761175 try {
11771176 Map <SubClusterId , SubClusterInfo > subClustersActive = getActiveSubclusters ();
11781177 final HttpServletRequest hsrCopy = clone (hsr );
@@ -1181,12 +1180,14 @@ public NodeToLabelsInfo getNodeToLabels(HttpServletRequest hsr)
11811180 ClientMethod remoteMethod = new ClientMethod ("getNodeToLabels" , argsClasses , args );
11821181 Map <SubClusterInfo , NodeToLabelsInfo > nodeToLabelsInfoMap =
11831182 invokeConcurrent (subClustersActive .values (), remoteMethod , NodeToLabelsInfo .class );
1184- nodeToLabelsInfo = RouterWebServiceUtil .mergeNodeToLabels (nodeToLabelsInfoMap );
1183+ return RouterWebServiceUtil .mergeNodeToLabels (nodeToLabelsInfoMap );
11851184 } catch (NotFoundException e ) {
11861185 LOG .error ("Get all active sub cluster(s) error." , e );
11871186 throw new IOException ("Get all active sub cluster(s) error." , e );
1187+ } catch (YarnException e ) {
1188+ LOG .error ("getNodeToLabels error." , e );
1189+ throw new IOException ("getNodeToLabels error." , e );
11881190 }
1189- return nodeToLabelsInfo ;
11901191 }
11911192
11921193 @ Override
@@ -1409,7 +1410,7 @@ public void shutdown() {
14091410 }
14101411
14111412 private <R > Map <SubClusterInfo , R > invokeConcurrent (Collection <SubClusterInfo > clusterIds ,
1412- ClientMethod request , Class <R > clazz ) {
1413+ ClientMethod request , Class <R > clazz ) throws YarnException {
14131414
14141415 Map <SubClusterInfo , R > results = new HashMap <>();
14151416
@@ -1427,9 +1428,10 @@ private <R> Map<SubClusterInfo, R> invokeConcurrent(Collection<SubClusterInfo> c
14271428 R ret = clazz .cast (retObj );
14281429 return ret ;
14291430 } catch (Exception e ) {
1430- LOG .error ("SubCluster {} failed to call {} method." , info .getSubClusterId (),
1431- request .getMethodName (), e );
1432- return null ;
1431+ String msg = String .format ("SubCluster %s failed to call %s method." ,
1432+ info .getSubClusterId (), request .getMethodName ());
1433+ LOG .error (msg , e );
1434+ throw new YarnRuntimeException (msg , e );
14331435 }
14341436 });
14351437 }
@@ -1442,7 +1444,10 @@ private <R> Map<SubClusterInfo, R> invokeConcurrent(Collection<SubClusterInfo> c
14421444 results .put (clusterId , response );
14431445 }
14441446 } catch (Throwable e ) {
1445- LOG .warn ("SubCluster {} failed to {} report." , clusterId , request .getMethodName (), e );
1447+ String msg = String .format ("SubCluster %s failed to %s report." ,
1448+ clusterId , request .getMethodName ());
1449+ LOG .warn (msg , e );
1450+ throw new YarnRuntimeException (msg , e );
14461451 }
14471452 });
14481453 return results ;
0 commit comments