private JobResponse handleJob(JobRequest request) {
		JobResponse response = new JobResponse(JobResponse.State.STANDBY, null);

		if (request.getState().equals(JobRequest.State.JOBDONE)) {
			customAppmaster.reportJobStatus(request.getJob(), true);
		} else if (request.getState().equals(JobRequest.State.JOBFAILED)) {
			customAppmaster.reportJobStatus(request.getJob(), false);
		}

		Long job = customAppmaster.getJob();
		response.setJob(job);
		if (job != null) {
			response.setState(JobResponse.State.RUNJOB);
		} else if (!customAppmaster.hasJobs()) {
			response.setState(JobResponse.State.DIE);
		}

		log.info("Response: state=" + response.getState() + " job=" + response.getJob());

		return response;
	}
Handles logic between {@link JobRequest} and {@link JobResponse}.

@param request the request
@return the response
yarn/yarn/custom-amservice/src/main/java/org/springframework/yarn/examples/CustomAppmasterService.java