@@ -790,8 +790,7 @@ public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
790
790
clusterNodes .put (subClusterId , response );
791
791
} catch (Exception ex ) {
792
792
routerMetrics .incrClusterNodesFailedRetrieved ();
793
- LOG .error ("Unable to get cluster nodes due to exception." , ex );
794
- throw ex ;
793
+ RouterServerUtil .logAndThrowException ("Unable to get cluster nodes due to exception." , ex );
795
794
}
796
795
}
797
796
long stopTime = clock .getTime ();
@@ -836,14 +835,13 @@ public GetQueueUserAclsInfoResponse getQueueUserAcls(
836
835
long startTime = clock .getTime ();
837
836
ClientMethod remoteMethod = new ClientMethod ("getQueueUserAcls" ,
838
837
new Class [] {GetQueueUserAclsInfoRequest .class }, new Object [] {request });
839
- Collection <GetQueueUserAclsInfoResponse > queueUserAcls ;
838
+ Collection <GetQueueUserAclsInfoResponse > queueUserAcls = null ;
840
839
try {
841
840
queueUserAcls = invokeAppClientProtocolMethod (true , remoteMethod ,
842
841
GetQueueUserAclsInfoResponse .class );
843
842
} catch (Exception ex ) {
844
843
routerMetrics .incrQueueUserAclsFailedRetrieved ();
845
- LOG .error ("Unable to get queue user Acls due to exception." , ex );
846
- throw ex ;
844
+ RouterServerUtil .logAndThrowException ("Unable to get queue user Acls due to exception." , ex );
847
845
}
848
846
long stopTime = clock .getTime ();
849
847
routerMetrics .succeededGetQueueUserAclsRetrieved (stopTime - startTime );
@@ -917,14 +915,14 @@ public ReservationListResponse listReservations(
917
915
long startTime = clock .getTime ();
918
916
ClientMethod remoteMethod = new ClientMethod ("listReservations" ,
919
917
new Class [] {ReservationListRequest .class }, new Object [] {request });
920
- Collection <ReservationListResponse > listResponses ;
918
+ Collection <ReservationListResponse > listResponses = null ;
921
919
try {
922
920
listResponses = invokeAppClientProtocolMethod (true , remoteMethod ,
923
921
ReservationListResponse .class );
924
922
} catch (Exception ex ) {
925
923
routerMetrics .incrListReservationsFailedRetrieved ();
926
- LOG . error ( "Unable to list reservations node due to exception." , ex );
927
- throw ex ;
924
+ RouterServerUtil . logAndThrowException (
925
+ "Unable to list reservations node due to exception." , ex ) ;
928
926
}
929
927
long stopTime = clock .getTime ();
930
928
routerMetrics .succeededListReservationsRetrieved (stopTime - startTime );
@@ -972,14 +970,13 @@ public GetNodesToLabelsResponse getNodeToLabels(
972
970
long startTime = clock .getTime ();
973
971
ClientMethod remoteMethod = new ClientMethod ("getNodeToLabels" ,
974
972
new Class [] {GetNodesToLabelsRequest .class }, new Object [] {request });
975
- Collection <GetNodesToLabelsResponse > clusterNodes ;
973
+ Collection <GetNodesToLabelsResponse > clusterNodes = null ;
976
974
try {
977
975
clusterNodes = invokeAppClientProtocolMethod (true , remoteMethod ,
978
976
GetNodesToLabelsResponse .class );
979
977
} catch (Exception ex ) {
980
978
routerMetrics .incrNodeToLabelsFailedRetrieved ();
981
- LOG .error ("Unable to get label node due to exception." , ex );
982
- throw ex ;
979
+ RouterServerUtil .logAndThrowException ("Unable to get node label due to exception." , ex );
983
980
}
984
981
long stopTime = clock .getTime ();
985
982
routerMetrics .succeededGetNodeToLabelsRetrieved (stopTime - startTime );
@@ -997,14 +994,13 @@ public GetLabelsToNodesResponse getLabelsToNodes(
997
994
long startTime = clock .getTime ();
998
995
ClientMethod remoteMethod = new ClientMethod ("getLabelsToNodes" ,
999
996
new Class [] {GetLabelsToNodesRequest .class }, new Object [] {request });
1000
- Collection <GetLabelsToNodesResponse > labelNodes ;
997
+ Collection <GetLabelsToNodesResponse > labelNodes = null ;
1001
998
try {
1002
999
labelNodes = invokeAppClientProtocolMethod (true , remoteMethod ,
1003
1000
GetLabelsToNodesResponse .class );
1004
1001
} catch (Exception ex ) {
1005
1002
routerMetrics .incrLabelsToNodesFailedRetrieved ();
1006
- LOG .error ("Unable to get label node due to exception." , ex );
1007
- throw ex ;
1003
+ RouterServerUtil .logAndThrowException ("Unable to get label node due to exception." , ex );
1008
1004
}
1009
1005
long stopTime = clock .getTime ();
1010
1006
routerMetrics .succeededGetLabelsToNodesRetrieved (stopTime - startTime );
@@ -1022,14 +1018,14 @@ public GetClusterNodeLabelsResponse getClusterNodeLabels(
1022
1018
long startTime = clock .getTime ();
1023
1019
ClientMethod remoteMethod = new ClientMethod ("getClusterNodeLabels" ,
1024
1020
new Class [] {GetClusterNodeLabelsRequest .class }, new Object [] {request });
1025
- Collection <GetClusterNodeLabelsResponse > nodeLabels ;
1021
+ Collection <GetClusterNodeLabelsResponse > nodeLabels = null ;
1026
1022
try {
1027
1023
nodeLabels = invokeAppClientProtocolMethod (true , remoteMethod ,
1028
1024
GetClusterNodeLabelsResponse .class );
1029
1025
} catch (Exception ex ) {
1030
1026
routerMetrics .incrClusterNodeLabelsFailedRetrieved ();
1031
- LOG . error ("Unable to get cluster nodeLabels due to exception." , ex );
1032
- throw ex ;
1027
+ RouterServerUtil . logAndThrowException ("Unable to get cluster nodeLabels due to exception." ,
1028
+ ex ) ;
1033
1029
}
1034
1030
long stopTime = clock .getTime ();
1035
1031
routerMetrics .succeededGetClusterNodeLabelsRetrieved (stopTime - startTime );
@@ -1082,15 +1078,15 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport(
1082
1078
ApplicationClientProtocol clientRMProxy =
1083
1079
getClientRMProxyForSubCluster (subClusterId );
1084
1080
1085
- GetApplicationAttemptReportResponse response ;
1081
+ GetApplicationAttemptReportResponse response = null ;
1086
1082
try {
1087
1083
response = clientRMProxy .getApplicationAttemptReport (request );
1088
1084
} catch (Exception e ) {
1089
1085
routerMetrics .incrAppAttemptsFailedRetrieved ();
1090
- LOG . error ( "Unable to get the applicationAttempt report for {} "
1091
- + " to SubCluster {}, error = {} ." ,
1092
- request .getApplicationAttemptId (), subClusterId .getId (), e );
1093
- throw e ;
1086
+ String msg = String . format (
1087
+ "Unable to get the applicationAttempt report for %s to SubCluster %s ." ,
1088
+ request .getApplicationAttemptId (), subClusterId .getId ());
1089
+ RouterServerUtil . logAndThrowException ( msg , e ) ;
1094
1090
}
1095
1091
1096
1092
if (response == null ) {
@@ -1314,8 +1310,7 @@ public UpdateApplicationPriorityResponse updateApplicationPriority(
1314
1310
} catch (YarnException e ) {
1315
1311
routerMetrics .incrUpdateAppPriorityFailedRetrieved ();
1316
1312
RouterServerUtil .logAndThrowException ("Application " +
1317
- request .getApplicationId () +
1318
- " does not exist in FederationStateStore." , e );
1313
+ request .getApplicationId () + " does not exist in FederationStateStore." , e );
1319
1314
}
1320
1315
1321
1316
ApplicationClientProtocol clientRMProxy = getClientRMProxyForSubCluster (subClusterId );
0 commit comments