Source:
public void run() { if (!isStarted.compareAndSet(false, true)) { LOG.warn("Attempting to start an already started job coordinator. "); return; } if (isJmxEnabled) { jmxServer = new JmxServer(); state.jmxUrl = jmxServer.getJmxUrl(); state.jmxTunnelingUrl = jmxServer.getTunnelingJmxUrl(); } else { jmxServer = null; } try { LOG.info("Starting cluster based job coordinator"); JobModel jobModel = jobModelManager.jobModel(); MetadataResourceUtil metadataResourceUtil = new MetadataResourceUtil(jobModel, metrics); metadataResourceUtil.createResources(); StartpointManager startpointManager = createStartpointManager(); startpointManager.start(); try { startpointManager.fanOut(new JobModelUtil(jobModel).getTaskToSystemStreamPartitions()); } finally { startpointManager.stop(); } Map<TaskName, Integer> prevPartitionMappings = changelogStreamManager.readPartitionMapping(); Map<TaskName, Integer> taskPartitionMappings = new HashMap<>(); Map<String, ContainerModel> containers = jobModel.getContainers(); for (ContainerModel containerModel : containers.values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { taskPartitionMappings.put(taskModel.getTaskName(), taskModel.getChangelogPartition().getPartitionId()); } } changelogStreamManager.updatePartitionMapping(prevPartitionMappings, taskPartitionMappings); containerProcessManager.start(); systemAdmins.start(); partitionMonitor.ifPresent(StreamPartitionCountMonitor::start); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::start); boolean isInterrupted = false; while (!containerProcessManager.shouldShutdown() && !checkAndThrowException() && !isInterrupted) { try { Thread.sleep(jobCoordinatorSleepInterval); } catch (InterruptedException e) { isInterrupted = true; LOG.error("Interrupted in job coordinator loop", e); Thread.currentThread().interrupt(); } } } catch (Throwable e) { LOG.error("Exception thrown in the JobCoordinator loop", e); throw new SamzaException(e); } finally { onShutDown(); } }

Target:
public void run() { if (!isStarted.compareAndSet(false, true)) { LOG.warn("Attempting to start an already started job coordinator. "); return; } if (isJmxEnabled) { jmxServer = new JmxServer(); state.jmxUrl = jmxServer.getJmxUrl(); state.jmxTunnelingUrl = jmxServer.getTunnelingJmxUrl(); } else { jmxServer = null; } try { LOG.info("Starting cluster based job coordinator"); JobModel jobModel = jobModelManager.jobModel(); MetadataResourceUtil metadataResourceUtil = new MetadataResourceUtil(jobModel, metrics); metadataResourceUtil.createResources(); StartpointManager startpointManager = createStartpointManager(); startpointManager.start(); try { startpointManager.fanOut(JobModelUtil.getTaskToSystemStreamPartitions(jobModel)); } finally { startpointManager.stop(); } Map<TaskName, Integer> prevPartitionMappings = changelogStreamManager.readPartitionMapping(); Map<TaskName, Integer> taskPartitionMappings = new HashMap<>(); Map<String, ContainerModel> containers = jobModel.getContainers(); for (ContainerModel containerModel : containers.values()) { for (TaskModel taskModel : containerModel.getTasks().values()) { taskPartitionMappings.put(taskModel.getTaskName(), taskModel.getChangelogPartition().getPartitionId()); } } changelogStreamManager.updatePartitionMapping(prevPartitionMappings, taskPartitionMappings); containerProcessManager.start(); systemAdmins.start(); partitionMonitor.ifPresent(StreamPartitionCountMonitor::start); inputStreamRegexMonitor.ifPresent(StreamRegexMonitor::start); boolean isInterrupted = false; while (!containerProcessManager.shouldShutdown() && !checkAndThrowException() && !isInterrupted) { try { Thread.sleep(jobCoordinatorSleepInterval); } catch (InterruptedException e) { isInterrupted = true; LOG.error("Interrupted in job coordinator loop", e); Thread.currentThread().interrupt(); } } } catch (Throwable e) { LOG.error("Exception thrown in the JobCoordinator loop", e); throw new SamzaException(e); } finally { onShutDown(); } }