Source:
private Optional<StreamRegexMonitor> getInputRegexMonitor(Config config, SystemAdmins systemAdmins) { if (new JobConfig(config).getMonitorRegexEnabled()) { LOG.info("StreamRegexMonitor is disabled."); return Optional.empty(); } StreamMetadataCache streamMetadata = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance()); Set<SystemStream> inputStreamsToMonitor = new TaskConfigJava(config).getAllInputStreams(); if (inputStreamsToMonitor.isEmpty()) { throw new SamzaException("Input streams to a job can not be empty."); } Option<String> rewritersList = new JobConfig(config).getConfigRewriters(); if (!rewritersList.isDefined()) { LOG.warn("No config rewriters are defined. No StreamRegexMonitor created."); return Optional.empty(); } Map<String, Pattern> inputRegexesToMonitor = JavaConverters.mapAsJavaMapConverter(new JobConfig(config).getMonitorRegexPatternMap(rewritersList.get())) .asJava(); if (inputRegexesToMonitor.isEmpty()) { LOG.info("No input regexes are defined. No StreamRegexMonitor created."); return Optional.empty(); } return Optional.of(new StreamRegexMonitor(inputStreamsToMonitor, inputRegexesToMonitor, streamMetadata, metrics, new JobConfig(config).getMonitorRegexFrequency(), new StreamRegexMonitor.Callback() { @Override public void onInputStreamsChanged(Set<SystemStream> initialInputSet, Set<SystemStream> newInputStreams, Map<String, Pattern> regexesMonitored) { if (hasDurableStores) { LOG.error("New input system-streams discovered. Failing the job. New input streams: {}", newInputStreams, " Existing input streams:", inputStreamsToMonitor); state.status = SamzaApplicationState.SamzaAppStatus.FAILED; } coordinatorException = new InputStreamsDiscoveredException("New input streams discovered: " + newInputStreams); } })); }

Target:
private Optional<StreamRegexMonitor> getInputRegexMonitor(Config config, SystemAdmins systemAdmins) { if (new JobConfig(config).getMonitorRegexEnabled()) { LOG.info("StreamRegexMonitor is disabled."); return Optional.empty(); } StreamMetadataCache streamMetadata = new StreamMetadataCache(systemAdmins, 0, SystemClock.instance()); Set<SystemStream> inputStreamsToMonitor = new TaskConfigJava(config).getAllInputStreams(); if (inputStreamsToMonitor.isEmpty()) { throw new SamzaException("Input streams to a job can not be empty."); } Option<String> rewritersList = new JobConfig(config).getConfigRewriters(); if (!rewritersList.isDefined()) { LOG.warn("No config rewriters are defined. No StreamRegexMonitor created."); return Optional.empty(); } Map<String, Pattern> inputRegexesToMonitor = JavaConverters.mapAsJavaMapConverter(new JobConfig(config).getMonitorRegexPatternMap(rewritersList.get())) .asJava(); if (inputRegexesToMonitor.isEmpty()) { LOG.info("No input regexes are defined. No StreamRegexMonitor created."); return Optional.empty(); } return Optional.of(new StreamRegexMonitor(inputStreamsToMonitor, inputRegexesToMonitor, streamMetadata, metrics, new JobConfig(config).getMonitorRegexFrequency(), new StreamRegexMonitor.Callback() { @Override public void onInputStreamsChanged(Set<SystemStream> initialInputSet, Set<SystemStream> newInputStreams, Map<String, Pattern> regexesMonitored) { if (hasDurableStores) { LOG.error("New input system-streams discovered. Failing the job. New input streams: {}" + " Existing input streams: {}", newInputStreams, inputStreamsToMonitor); state.status = SamzaApplicationState.SamzaAppStatus.FAILED; } coordinatorException = new InputStreamsDiscoveredException("New input streams discovered: " + newInputStreams); } })); }