private static RegisterApplicationMasterResponse registerApplicationMaster(
AMRMProtocol resourceManager, ApplicationAttemptId appAttemptID,
String appMasterHostName, int appMasterRpcPort,
String appMasterTrackingUrl) throws YarnRemoteException {
RegisterApplicationMasterRequest appMasterRequest = Records
.newRecord(RegisterApplicationMasterRequest.class);
appMasterRequest.setApplicationAttemptId(appAttemptID);
appMasterRequest.setHost(appMasterHostName);
appMasterRequest.setRpcPort(appMasterRpcPort);
// TODO tracking URL
appMasterRequest.setTrackingUrl(appMasterTrackingUrl);
RegisterApplicationMasterResponse response = resourceManager
.registerApplicationMaster(appMasterRequest);
LOG.debug("ApplicationMaster has maximum resource capability of: "
+ response.getMaximumResourceCapability().getMemory());
return response;