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(); CheckpointManager checkpointManager = new TaskConfigJava(config).getCheckpointManager(metrics); if (checkpointManager != null) { checkpointManager.createResources(); } ChangelogStreamManager.createChangelogStreams(jobModel.getConfig(), jobModel.maxChangeLogStreamPartitions); 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(); CheckpointManager checkpointManager = new TaskConfigJava(config).getCheckpointManager(metrics); if (checkpointManager != null) { checkpointManager.createResources(); } ChangelogStreamManager.createChangelogStreams(jobModel.getConfig(), jobModel.maxChangeLogStreamPartitions); 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(); } }