@@ -806,9 +806,10 @@ public GetApplicationsResponse getApplications(GetApplicationsRequest request)
806806 throws YarnException , IOException {
807807 if (request == null ) {
808808 routerMetrics .incrMultipleAppsFailedRetrieved ();
809+ String msg = "Missing getApplications request." ;
809810 RouterAuditLogger .logFailure (user .getShortUserName (), GET_APPLICATIONS , UNKNOWN ,
810- TARGET_CLIENT_RM_SERVICE , "Missing getApplications request." );
811- RouterServerUtil .logAndThrowException ("Missing getApplications request." , null );
811+ TARGET_CLIENT_RM_SERVICE , msg );
812+ RouterServerUtil .logAndThrowException (msg , null );
812813 }
813814 long startTime = clock .getTime ();
814815 ClientMethod remoteMethod = new ClientMethod ("getApplications" ,
@@ -831,9 +832,10 @@ public GetClusterMetricsResponse getClusterMetrics(
831832 GetClusterMetricsRequest request ) throws YarnException , IOException {
832833 if (request == null ) {
833834 routerMetrics .incrGetClusterMetricsFailedRetrieved ();
835+ String msg = "Missing getApplications request." ;
834836 RouterAuditLogger .logFailure (user .getShortUserName (), GET_CLUSTERMETRICS , UNKNOWN ,
835- TARGET_CLIENT_RM_SERVICE , "Missing getApplications request." );
836- RouterServerUtil .logAndThrowException ("Missing getClusterMetrics request." , null );
837+ TARGET_CLIENT_RM_SERVICE , msg );
838+ RouterServerUtil .logAndThrowException (msg , null );
837839 }
838840 long startTime = clock .getTime ();
839841 ClientMethod remoteMethod = new ClientMethod ("getClusterMetrics" ,
@@ -913,9 +915,10 @@ public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
913915 throws YarnException , IOException {
914916 if (request == null ) {
915917 routerMetrics .incrClusterNodesFailedRetrieved ();
918+ String msg = "Missing getClusterNodes request." ;
916919 RouterAuditLogger .logFailure (user .getShortUserName (), GET_CLUSTERNODES , UNKNOWN ,
917- TARGET_CLIENT_RM_SERVICE , "Missing getClusterNodes request." );
918- RouterServerUtil .logAndThrowException ("Missing getClusterNodes request." , null );
920+ TARGET_CLIENT_RM_SERVICE , msg );
921+ RouterServerUtil .logAndThrowException (msg , null );
919922 }
920923 long startTime = clock .getTime ();
921924 ClientMethod remoteMethod = new ClientMethod ("getClusterNodes" ,
@@ -938,9 +941,10 @@ public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request)
938941 throws YarnException , IOException {
939942 if (request == null || request .getQueueName () == null ) {
940943 routerMetrics .incrGetQueueInfoFailedRetrieved ();
944+ String msg = "Missing getQueueInfo request or queueName." ;
941945 RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUEINFO , UNKNOWN ,
942- TARGET_CLIENT_RM_SERVICE , "Missing getQueueInfo request or queueName." );
943- RouterServerUtil .logAndThrowException ("Missing getQueueInfo request or queueName." , null );
946+ TARGET_CLIENT_RM_SERVICE , msg );
947+ RouterServerUtil .logAndThrowException (msg , null );
944948 }
945949
946950 long startTime = clock .getTime ();
@@ -965,9 +969,10 @@ public GetQueueUserAclsInfoResponse getQueueUserAcls(
965969 GetQueueUserAclsInfoRequest request ) throws YarnException , IOException {
966970 if (request == null ){
967971 routerMetrics .incrQueueUserAclsFailedRetrieved ();
972+ String msg = "Missing getQueueUserAcls request." ;
968973 RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUE_USER_ACLS , UNKNOWN ,
969- TARGET_CLIENT_RM_SERVICE , "Missing getQueueUserAcls request." );
970- RouterServerUtil .logAndThrowException ("Missing getQueueUserAcls request." , null );
974+ TARGET_CLIENT_RM_SERVICE , msg );
975+ RouterServerUtil .logAndThrowException (msg );
971976 }
972977 long startTime = clock .getTime ();
973978 ClientMethod remoteMethod = new ClientMethod ("getQueueUserAcls" ,
@@ -991,11 +996,11 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
991996 throws YarnException , IOException {
992997 if (request == null || request .getApplicationId () == null || request .getTargetQueue () == null ) {
993998 routerMetrics .incrMoveApplicationAcrossQueuesFailedRetrieved ();
999+ String msg = "Missing moveApplicationAcrossQueues request or " +
1000+ "applicationId or target queue." ;
9941001 RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUE_USER_ACLS , UNKNOWN ,
995- TARGET_CLIENT_RM_SERVICE , "Missing moveApplicationAcrossQueues request or " +
996- "applicationId or target queue." );
997- RouterServerUtil .logAndThrowException ("Missing moveApplicationAcrossQueues request or " +
998- "applicationId or target queue." , null );
1002+ TARGET_CLIENT_RM_SERVICE , msg );
1003+ RouterServerUtil .logAndThrowException (msg );
9991004 }
10001005
10011006 long startTime = clock .getTime ();
@@ -1007,8 +1012,8 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
10071012 .getApplicationHomeSubCluster (applicationId );
10081013 } catch (YarnException e ) {
10091014 routerMetrics .incrMoveApplicationAcrossQueuesFailedRetrieved ();
1010- RouterServerUtil . logAndThrowException ( e , "Application %s does not exist in FederationStateStore." ,
1011- applicationId );
1015+ String errMsgFormat = "Application %s does not exist in FederationStateStore." ;
1016+ RouterServerUtil . logAndThrowException ( e , errMsgFormat , applicationId );
10121017 }
10131018
10141019 ApplicationClientProtocol clientRMProxy = getClientRMProxyForSubCluster (subClusterId );
0 commit comments