diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index 0db775f..aa2ec75 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -198,7 +198,7 @@ protected RMDelegationTokenSecretManager rmDTSecretManager; private final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); - InetSocketAddress clientBindAddress; + private InetSocketAddress clientBindAddress; private final ApplicationACLsManager applicationsACLsManager; private final QueueACLsManager queueACLsManager; @@ -300,11 +300,11 @@ public InetSocketAddress getBindAddress() { /** * check if the calling user has the access to application information. - * @param callerUGI - * @param owner - * @param operationPerformed - * @param application - * @return + * @param callerUGI The user information who submit the request + * @param owner The user of the application + * @param operationPerformed The type of operation defined in {@link ApplicationAccessType} + * @param application Submitted application + * @return Access is permitted or not */ private boolean checkAccess(UserGroupInformation callerUGI, String owner, ApplicationAccessType operationPerformed, RMApp application) { @@ -413,7 +413,7 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport( response = GetApplicationAttemptReportResponse.newInstance(attemptReport); }else{ throw new YarnException("User " + callerUGI.getShortUserName() - + " does not have privilage to see this attempt " + appAttemptId); + + " does not have privilege to see this attempt " + appAttemptId); } return response; } @@ -453,7 +453,7 @@ public GetApplicationAttemptsResponse getApplicationAttempts( response = GetApplicationAttemptsResponse.newInstance(listAttempts); } else { throw new YarnException("User " + callerUGI.getShortUserName() - + " does not have privilage to see this application " + appId); + + " does not have privilege to see this application " + appId); } return response; } @@ -494,13 +494,13 @@ public GetContainerReportResponse getContainerReport( "ApplicationAttempt with id '" + appAttemptId + "' doesn't exist in RM."); } - RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer( + RMContainer rmContainer = this.rmContext.getScheduler().getRMContainer( containerId); - if (rmConatiner == null) { + if (rmContainer == null) { throw new ContainerNotFoundException("Container with id '" + containerId + "' doesn't exist in RM."); } - response = GetContainerReportResponse.newInstance(rmConatiner + response = GetContainerReportResponse.newInstance(rmContainer .createContainerReport()); } else { throw new YarnException("User " + callerUGI.getShortUserName() @@ -557,7 +557,7 @@ public GetContainersResponse getContainers(GetContainersRequest request) response = GetContainersResponse.newInstance(listContainers); } else { throw new YarnException("User " + callerUGI.getShortUserName() - + " does not have privilage to see this application " + appId); + + " does not have privilege to see this application " + appId); } return response; } @@ -597,6 +597,7 @@ public SubmitApplicationResponse submitApplication( TimelineUtils.FLOW_RUN_ID_TAG_PREFIX.toLowerCase() + ":")) { value = tag.substring(TimelineUtils.FLOW_RUN_ID_TAG_PREFIX.length() + 1); + // In order to check the number format Long.valueOf(value); } } @@ -659,9 +660,8 @@ public SubmitApplicationResponse submitApplication( throw e; } - SubmitApplicationResponse response = recordFactory + return recordFactory .newRecordInstance(SubmitApplicationResponse.class); - return response; } @SuppressWarnings("unchecked") @@ -798,7 +798,7 @@ public KillApplicationResponse forceKillApplication( .handle(new RMAppKillByClientEvent(applicationId, message.toString(), callerUGI, remoteAddress)); - // For UnmanagedAMs, return true so they don't retry + // For Unmanaged AMs, return true so they don't retry return KillApplicationResponse.newInstance( application.getApplicationSubmissionContext().getUnmanagedAM()); } @@ -1090,15 +1090,15 @@ public GetDelegationTokenResponse getDelegationToken( RMDelegationTokenIdentifier tokenIdentifier = new RMDelegationTokenIdentifier(owner, new Text(request.getRenewer()), realUser); - Token realRMDTtoken = + Token realRMDToken = new Token(tokenIdentifier, this.rmDTSecretManager); response.setRMDelegationToken( BuilderUtils.newDelegationToken( - realRMDTtoken.getIdentifier(), - realRMDTtoken.getKind().toString(), - realRMDTtoken.getPassword(), - realRMDTtoken.getService().toString() + realRMDToken.getIdentifier(), + realRMDToken.getKind().toString(), + realRMDToken.getPassword(), + realRMDToken.getService().toString() )); return response; } catch(IOException io) { @@ -1217,9 +1217,8 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues( RMAuditLogger.logSuccess(callerUGI.getShortUserName(), AuditConstants.MOVE_APP_REQUEST, "ClientRMService" , applicationId); - MoveApplicationAcrossQueuesResponse response = recordFactory + return recordFactory .newRecordInstance(MoveApplicationAcrossQueuesResponse.class); - return response; } private String getRenewerForToken(Token token) @@ -1258,7 +1257,7 @@ public Server getServer() { @Override public GetNewReservationResponse getNewReservation( GetNewReservationRequest request) throws YarnException, IOException { - checkReservationSytem(AuditConstants.CREATE_NEW_RESERVATION_REQUEST); + checkReservationSystem(AuditConstants.CREATE_NEW_RESERVATION_REQUEST); GetNewReservationResponse response = recordFactory.newRecordInstance(GetNewReservationResponse.class); @@ -1272,7 +1271,7 @@ public GetNewReservationResponse getNewReservation( public ReservationSubmissionResponse submitReservation( ReservationSubmissionRequest request) throws YarnException, IOException { // Check if reservation system is enabled - checkReservationSytem(AuditConstants.SUBMIT_RESERVATION_REQUEST); + checkReservationSystem(AuditConstants.SUBMIT_RESERVATION_REQUEST); ReservationSubmissionResponse response = recordFactory.newRecordInstance(ReservationSubmissionResponse.class); ReservationId reservationId = request.getReservationId(); @@ -1331,7 +1330,7 @@ public ReservationSubmissionResponse submitReservation( public ReservationUpdateResponse updateReservation( ReservationUpdateRequest request) throws YarnException, IOException { // Check if reservation system is enabled - checkReservationSytem(AuditConstants.UPDATE_RESERVATION_REQUEST); + checkReservationSystem(AuditConstants.UPDATE_RESERVATION_REQUEST); ReservationUpdateResponse response = recordFactory.newRecordInstance(ReservationUpdateResponse.class); // Validate the input @@ -1370,7 +1369,7 @@ public ReservationUpdateResponse updateReservation( public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { // Check if reservation system is enabled - checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST); + checkReservationSystem(AuditConstants.DELETE_RESERVATION_REQUEST); ReservationDeleteResponse response = recordFactory.newRecordInstance(ReservationDeleteResponse.class); // Validate the input @@ -1409,7 +1408,7 @@ public ReservationDeleteResponse deleteReservation( public ReservationListResponse listReservations( ReservationListRequest requestInfo) throws YarnException, IOException { // Check if reservation system is enabled - checkReservationSytem(AuditConstants.LIST_RESERVATION_REQUEST); + checkReservationSystem(AuditConstants.LIST_RESERVATION_REQUEST); ReservationListResponse response = recordFactory.newRecordInstance(ReservationListResponse.class); @@ -1449,9 +1448,7 @@ public ReservationListResponse listReservations( public GetNodesToLabelsResponse getNodeToLabels( GetNodesToLabelsRequest request) throws YarnException, IOException { RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager(); - GetNodesToLabelsResponse response = - GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabelsInfo()); - return response; + return GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabelsInfo()); } @Override @@ -1471,13 +1468,11 @@ public GetLabelsToNodesResponse getLabelsToNodes( public GetClusterNodeLabelsResponse getClusterNodeLabels( GetClusterNodeLabelsRequest request) throws YarnException, IOException { RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager(); - GetClusterNodeLabelsResponse response = - GetClusterNodeLabelsResponse.newInstance( + return GetClusterNodeLabelsResponse.newInstance( labelsMgr.getClusterNodeLabels()); - return response; } - private void checkReservationSytem(String auditConstant) throws YarnException { + private void checkReservationSystem(String auditConstant) throws YarnException { // Check if reservation is enabled if (reservationSystem == null) { throw RPCUtil.getRemoteException("Reservation is not enabled."