Source:
<code>public void requestResources(SamzaResourceRequest resourceRequest) { String processorId = resourceRequest.getProcessorId(); String requestId = resourceRequest.getRequestId(); String preferredHost = resourceRequest.getPreferredHost(); <START> String[] racks = null; ClusterManagerConfig clusterManagerConfig = new ClusterManagerConfig(config); if (clusterManagerConfig.getFaultDomainAwareStandbyEnabled()) { racks = resourceRequest.getFaultDomains().stream().map(FaultDomain::getId).toArray(String[]::new); } <END> int memoryMb = resourceRequest.getMemoryMB(); int cpuCores = resourceRequest.getNumCores(); Resource capability = Resource.newInstance(memoryMb, cpuCores); String nodeLabelsExpression = yarnConfig.getContainerLabel(); AMRMClient.ContainerRequest issuedRequest; if (preferredHost.equals("ANY_HOST")) { Priority priority = Priority.newInstance(ANY_HOST_PRIORITY); boolean relaxLocality = true; log.info("Requesting resources for Processor ID: on nodes: on racks: with capability: {}, priority: {}, relaxLocality: {}, nodeLabelsExpression: {}", processorId, null, Arrays.toString(racks), capability, priority, relaxLocality, nodeLabelsExpression); issuedRequest = new AMRMClient.ContainerRequest(capability, null, null, priority, relaxLocality, nodeLabelsExpression); } else { String[] nodes = {preferredHost}; Priority priority = Priority.newInstance(PREFERRED_HOST_PRIORITY); boolean relaxLocality = false; log.info("Requesting resources for Processor ID: on nodes: on racks: with capability: {}, priority: {}, relaxLocality: {}, nodeLabelsExpression: {}", processorId, Arrays.toString(nodes), Arrays.toString(racks), capability, priority, relaxLocality, nodeLabelsExpression); issuedRequest = new AMRMClient.ContainerRequest(capability, nodes, racks, priority, relaxLocality, nodeLabelsExpression); } synchronized (lock) { requestsMap.put(resourceRequest, issuedRequest); amClient.addContainerRequest(issuedRequest); } }</code><technical_language>do control flow pass empty array instead of null if change semantically in YARN? so, eliminate unnecessary control flow faultDomains is guaranteed empty present, null handling is necessary well</technical_language>

Target:
public void requestResources(SamzaResourceRequest resourceRequest) { String processorId = resourceRequest.getProcessorId(); String requestId = resourceRequest.getRequestId(); String preferredHost = resourceRequest.getPreferredHost(); String[] racks = resourceRequest.getFaultDomains().stream().map(FaultDomain::getId).toArray(String[]::new); int memoryMb = resourceRequest.getMemoryMB(); int cpuCores = resourceRequest.getNumCores(); Resource capability = Resource.newInstance(memoryMb, cpuCores); String nodeLabelsExpression = yarnConfig.getContainerLabel(); AMRMClient.ContainerRequest issuedRequest; if (preferredHost.equals("ANY_HOST")) { Priority priority = Priority.newInstance(ANY_HOST_PRIORITY); boolean relaxLocality = true; log.info("Requesting resources for Processor ID: on nodes: on racks: with capability: {}, priority: {}, relaxLocality: {}, nodeLabelsExpression: {}", processorId, null, Arrays.toString(racks), capability, priority, relaxLocality, nodeLabelsExpression); issuedRequest = new AMRMClient.ContainerRequest(capability, null, null, priority, relaxLocality, nodeLabelsExpression); } else { String[] nodes = {preferredHost}; Priority priority = Priority.newInstance(PREFERRED_HOST_PRIORITY); boolean relaxLocality = false; log.info("Requesting resources for Processor ID: on nodes: on racks: with capability: {}, priority: {}, relaxLocality: {}, nodeLabelsExpression: {}", processorId, Arrays.toString(nodes), Arrays.toString(racks), capability, priority, relaxLocality, nodeLabelsExpression); issuedRequest = new AMRMClient.ContainerRequest(capability, nodes, racks, priority, relaxLocality, nodeLabelsExpression); } synchronized (lock) { requestsMap.put(resourceRequest, issuedRequest); amClient.addContainerRequest(issuedRequest); } }