Source:
<code>public void start() { LOG.info("Starting the container process manager"); int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } <START> if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { LOG.info( "Set neededProcessors prior to starting clusterResourceManager because it gets running containres from prev attempts in AM HA."); state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); } LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); if (!jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); } <END> LocalityModel localityModel = localityManager.readLocality(); Map<String, String> processorToHost = new HashMap<>(); state.jobModelManager.jobModel().getContainers().keySet().forEach((containerId) -> { String host = Optional.ofNullable(localityModel.getProcessorLocality(containerId)) .map(ProcessorLocality::host) .filter(StringUtils::isNotBlank) .orElse(null); processorToHost.put(containerId, host); }); if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.runningProcessors.keySet().forEach(containerId -> { processorToHost.remove(containerId); state.neededProcessors.decrementAndGet(); }); } containerAllocator.requestResources(processorToHost); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }</code><technical_language>If i reading this right, of enabled logging additionally. 1. move initializations clusterResourceManager.start() consolidate this</technical_language>

Target:
public void start() { LOG.info("Starting the container process manager"); int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); LocalityModel localityModel = localityManager.readLocality(); Map<String, String> processorToHost = new HashMap<>(); state.jobModelManager.jobModel().getContainers().keySet().forEach((containerId) -> { String host = Optional.ofNullable(localityModel.getProcessorLocality(containerId)) .map(ProcessorLocality::host) .filter(StringUtils::isNotBlank) .orElse(null); processorToHost.put(containerId, host); }); if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.runningProcessors.keySet().forEach(processorToHost::remove); } containerAllocator.requestResources(processorToHost); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }