Source:
public static Runnable createRunLoop(scala.collection.immutable.Map<TaskName, TaskInstance> taskInstances, SystemConsumers consumerMultiplexer, ExecutorService threadPool, long maxThrottlingDelayMs, SamzaContainerMetrics containerMetrics, TaskConfig config, HighResolutionClock clock) { long taskWindowMs = config.getWindowMs().getOrElse(defaultValue(DEFAULT_WINDOW_MS)); log.info("Got window milliseconds: " + taskWindowMs); long taskCommitMs = config.getCommitMs().getOrElse(defaultValue(DEFAULT_COMMIT_MS)); log.info("Got commit milliseconds: " + taskCommitMs); int asyncTaskCount = taskInstances.values().count(new AbstractFunction1<TaskInstance, Object>() { @Override public Boolean apply(TaskInstance t) { return t.isAsyncTask(); } }); if (asyncTaskCount > 0 && asyncTaskCount < taskInstances.size()) { throw new SamzaException("Mixing StreamTask and AsyncStreamTask is not supported"); } if (asyncTaskCount == 0) { log.info("Run loop in single thread mode."); return new RunLoop( taskInstances, consumerMultiplexer, containerMetrics, maxThrottlingDelayMs, taskWindowMs, taskCommitMs, asScalaClock(() -> System.nanoTime())); } else { Integer taskMaxConcurrency = config.getMaxConcurrency().getOrElse(defaultValue(1)); log.info("Got max messages in flight: " + taskMaxConcurrency); boolean isAsyncCommitEnabled = config.getAsyncCommit().getOrElse(defaultValue(false)); log.info("Got asyncCommitEnabled: from config.", isAsyncCommitEnabled); Long callbackTimeout = config.getCallbackTimeoutMs().getOrElse(defaultValue(DEFAULT_CALLBACK_TIMEOUT_MS)); log.info("Got callback timeout: " + callbackTimeout); log.info("Run loop in asynchronous mode."); return new AsyncRunLoop( JavaConverters.mapAsJavaMapConverter(taskInstances).asJava(), threadPool, consumerMultiplexer, taskMaxConcurrency, taskWindowMs, taskCommitMs, callbackTimeout, maxThrottlingDelayMs, containerMetrics, clock, isAsyncCommitEnabled); } }

Target:
public static Runnable createRunLoop(scala.collection.immutable.Map<TaskName, TaskInstance> taskInstances, SystemConsumers consumerMultiplexer, ExecutorService threadPool, long maxThrottlingDelayMs, SamzaContainerMetrics containerMetrics, TaskConfig config, HighResolutionClock clock) { long taskWindowMs = config.getWindowMs().getOrElse(defaultValue(DEFAULT_WINDOW_MS)); log.info("Got window milliseconds: {}.", taskWindowMs); long taskCommitMs = config.getCommitMs().getOrElse(defaultValue(DEFAULT_COMMIT_MS)); log.info("Got commit milliseconds: {}.", taskCommitMs); int asyncTaskCount = taskInstances.values().count(new AbstractFunction1<TaskInstance, Object>() { @Override public Boolean apply(TaskInstance t) { return t.isAsyncTask(); } }); if (asyncTaskCount > 0 && asyncTaskCount < taskInstances.size()) { throw new SamzaException("Mixing StreamTask and AsyncStreamTask is not supported"); } if (asyncTaskCount == 0) { log.info("Run loop in single thread mode."); return new RunLoop( taskInstances, consumerMultiplexer, containerMetrics, maxThrottlingDelayMs, taskWindowMs, taskCommitMs, asScalaClock(() -> System.nanoTime())); } else { Integer taskMaxConcurrency = config.getMaxConcurrency().getOrElse(defaultValue(1)); log.info("Got taskMaxConcurrency: {}.", taskMaxConcurrency); boolean isAsyncCommitEnabled = config.getAsyncCommit().getOrElse(defaultValue(false)); log.info("Got asyncCommitEnabled: {}.", isAsyncCommitEnabled); Long callbackTimeout = config.getCallbackTimeoutMs().getOrElse(defaultValue(DEFAULT_CALLBACK_TIMEOUT_MS)); log.info("Got callbackTimeout: {}.", callbackTimeout); log.info("Run loop in asynchronous mode."); return new AsyncRunLoop( JavaConverters.mapAsJavaMapConverter(taskInstances).asJava(), threadPool, consumerMultiplexer, taskMaxConcurrency, taskWindowMs, taskCommitMs, callbackTimeout, maxThrottlingDelayMs, containerMetrics, clock, isAsyncCommitEnabled); } }