Source:
public ContainerProcessManager(Config config, SamzaApplicationState state, MetricsRegistryMap registry) { this.state = state; this.clusterManagerConfig = new ClusterManagerConfig(config); this.jobConfig = new JobConfig(config); this.hostAffinityEnabled = clusterManagerConfig.getHostAffinityEnabled(); ResourceManagerFactory factory = getContainerProcessManagerFactory(clusterManagerConfig); this.clusterResourceManager = checkNotNull(factory.getClusterResourceManager(this, state)); this.containerProcessManagerMetrics = new ContainerProcessManagerMetrics(config, state, registry); this.jvmMetrics = new JvmMetrics(registry); this.metricsReporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), METRICS_SOURCE_NAME); Optional<String> execEnvContainerId = Optional.ofNullable(System.getenv("CONTAINER_ID")); Optional<Tuple2<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(new JobConfig(config).getName().get(), new JobConfig(config).getJobId(), METRICS_SOURCE_NAME, execEnvContainerId, config); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get()._1()); metricsReporters.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get()._2()); } else { diagnosticsManager = Option.empty(); } this.metricsReporters.values().forEach(reporter -> reporter.register(METRICS_SOURCE_NAME, registry)); if (jobConfig.getStandbyTasksEnabled()) { this.standbyContainerManager = Optional.of(new StandbyContainerManager(state, clusterResourceManager)); } else { this.standbyContainerManager = Optional.empty(); } if (this.hostAffinityEnabled) { this.containerAllocator = new HostAwareContainerAllocator(clusterResourceManager, clusterManagerConfig.getContainerRequestTimeout(), config, standbyContainerManager, state); } else { this.containerAllocator = new ContainerAllocator(clusterResourceManager, config, state); } this.allocatorThread = new Thread(this.containerAllocator, "Container Allocator Thread"); log.info("Finished container process manager initialization."); }

Target:
public ContainerProcessManager(Config config, SamzaApplicationState state, MetricsRegistryMap registry) { this.state = state; this.clusterManagerConfig = new ClusterManagerConfig(config); this.jobConfig = new JobConfig(config); this.hostAffinityEnabled = clusterManagerConfig.getHostAffinityEnabled(); ResourceManagerFactory factory = getContainerProcessManagerFactory(clusterManagerConfig); this.clusterResourceManager = checkNotNull(factory.getClusterResourceManager(this, state)); this.containerProcessManagerMetrics = new ContainerProcessManagerMetrics(config, state, registry); this.jvmMetrics = new JvmMetrics(registry); this.metricsReporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), METRICS_SOURCE_NAME); String jobName = new JobConfig(config).getName().get(); String jobId = new JobConfig(config).getJobId(); Optional<String> execEnvContainerId = Optional.ofNullable(System.getenv(EXEC_ENV_CONTAINER_ID_SYS_PROPERTY)); Optional<Pair<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(jobName, jobId, METRICS_SOURCE_NAME, execEnvContainerId, config); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get().getKey()); metricsReporters.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get().getValue()); } else { diagnosticsManager = Option.empty(); } this.metricsReporters.values().forEach(reporter -> reporter.register(METRICS_SOURCE_NAME, registry)); if (jobConfig.getStandbyTasksEnabled()) { this.standbyContainerManager = Optional.of(new StandbyContainerManager(state, clusterResourceManager)); } else { this.standbyContainerManager = Optional.empty(); } if (this.hostAffinityEnabled) { this.containerAllocator = new HostAwareContainerAllocator(clusterResourceManager, clusterManagerConfig.getContainerRequestTimeout(), config, standbyContainerManager, state); } else { this.containerAllocator = new ContainerAllocator(clusterResourceManager, config, state); } this.allocatorThread = new Thread(this.containerAllocator, "Container Allocator Thread"); log.info("Finished container process manager initialization."); }