Source:
protected JobModel getJobModel(JobInstance jobInstance) { CoordinatorStreamSystemConsumer coordinatorSystemConsumer = null; CoordinatorStreamSystemProducer coordinatorSystemProducer = null; try { CoordinatorStreamSystemFactory coordinatorStreamSystemFactory = new CoordinatorStreamSystemFactory(); Config coordinatorSystemConfig = getCoordinatorSystemConfig(jobInstance); LOG.info("Using config: to create coordinatorStream producer and consumer.", coordinatorSystemConfig); coordinatorSystemConsumer = coordinatorStreamSystemFactory.getCoordinatorStreamSystemConsumer(coordinatorSystemConfig, METRICS_REGISTRY); coordinatorSystemProducer = coordinatorStreamSystemFactory.getCoordinatorStreamSystemProducer(coordinatorSystemConfig, METRICS_REGISTRY); LOG.info("Registering coordinator system stream consumer."); coordinatorSystemConsumer.register(); LOG.debug("Starting coordinator system stream consumer."); coordinatorSystemConsumer.start(); LOG.debug("Bootstrapping coordinator system stream consumer."); coordinatorSystemConsumer.bootstrap(); LOG.info("Registering coordinator system stream producer."); coordinatorSystemProducer.register(SOURCE); Config config = coordinatorSystemConsumer.getConfig(); LOG.info("Got config from coordinatorSystemConsumer: {}.", config); ChangelogPartitionManager changelogManager = new ChangelogPartitionManager(coordinatorSystemProducer, coordinatorSystemConsumer, SOURCE); changelogManager.start(); LocalityManager localityManager = new LocalityManager(coordinatorSystemProducer, coordinatorSystemConsumer); localityManager.start(); String jobCoordinatorSystemName = config.get(JobConfig.JOB_COORDINATOR_SYSTEM()); Config systemAdminConfig = config.subset(String.format("systems.%s", jobCoordinatorSystemName), false); StreamMetadataCache streamMetadataCache = new StreamMetadataCache(JobModelManager.getSystemAdmins(systemAdminConfig), 0, SystemClock.instance()); return JobModelManager.readJobModel(config, changelogManager.readChangeLogPartitionMapping(), localityManager, streamMetadataCache, null); } finally { if (coordinatorSystemConsumer != null) { coordinatorSystemConsumer.stop(); } if (coordinatorSystemProducer != null) { coordinatorSystemProducer.stop(); } } }

Target:
protected JobModel getJobModel(JobInstance jobInstance) { CoordinatorStreamSystemConsumer coordinatorSystemConsumer = null; CoordinatorStreamSystemProducer coordinatorSystemProducer = null; try { CoordinatorStreamSystemFactory coordinatorStreamSystemFactory = new CoordinatorStreamSystemFactory(); Config coordinatorSystemConfig = getCoordinatorSystemConfig(jobInstance); LOG.info("Using config: to create coordinatorStream producer and consumer.", coordinatorSystemConfig); coordinatorSystemConsumer = coordinatorStreamSystemFactory.getCoordinatorStreamSystemConsumer(coordinatorSystemConfig, METRICS_REGISTRY); coordinatorSystemProducer = coordinatorStreamSystemFactory.getCoordinatorStreamSystemProducer(coordinatorSystemConfig, METRICS_REGISTRY); LOG.info("Registering coordinator system stream consumer."); coordinatorSystemConsumer.register(); LOG.debug("Starting coordinator system stream consumer."); coordinatorSystemConsumer.start(); LOG.debug("Bootstrapping coordinator system stream consumer."); coordinatorSystemConsumer.bootstrap(); LOG.info("Registering coordinator system stream producer."); coordinatorSystemProducer.register(SOURCE); Config config = coordinatorSystemConsumer.getConfig(); LOG.info("Got config from coordinatorSystemConsumer: {}.", config); ChangelogPartitionManager changelogManager = new ChangelogPartitionManager(coordinatorSystemProducer, coordinatorSystemConsumer, SOURCE); changelogManager.start(); LocalityManager localityManager = new LocalityManager(coordinatorSystemProducer, coordinatorSystemConsumer); localityManager.start(); String jobCoordinatorSystemName = config.get(JobConfig.JOB_COORDINATOR_SYSTEM()); Config systemAdminConfig = config.subset(String.format("systems.%s", jobCoordinatorSystemName), false); scala.collection.immutable.Map<String, SystemAdmin> systemAdmins = JobModelManager.getSystemAdmins(systemAdminConfig); StreamMetadataCache streamMetadataCache = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance()); Map<TaskName, Integer> changeLogPartitionMapping = changelogManager.readChangeLogPartitionMapping(); return JobModelManager.readJobModel(config, changeLogPartitionMapping, localityManager, streamMetadataCache, null); } finally { if (coordinatorSystemConsumer != null) { coordinatorSystemConsumer.stop(); } if (coordinatorSystemProducer != null) { coordinatorSystemProducer.stop(); } } }