Source:
public void initializeTaskRunnerFactory() { if (taskRunnerFactory == null) { if (config.getRunnerImpl().equals("remote")) { taskRunnerFactory = new TaskRunnerFactory() { @Override public TaskRunner build() { final ScheduledExecutorService retryScheduledExec = Executors.newScheduledThreadPool( 1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("RemoteRunnerRetryExec--%d") .build() ); ScalingStrategy strategy = new S3AutoScalingStrategy( new AmazonEC2Client( new BasicAWSCredentials( props.getProperty("com.metamx.aws.accessKey"), props.getProperty("com.metamx.aws.secretKey") ) ), configFactory.build(S3AutoScalingStrategyConfig.class) ); strategy = new NoopScalingStrategy(configFactory.build(S3AutoScalingStrategyConfig.class)); return new RemoteTaskRunner( jsonMapper, configFactory.build(RemoteTaskRunnerConfig.class), curatorFramework, new PathChildrenCache(curatorFramework, indexerZkConfig.getAnnouncementPath(), false), retryScheduledExec, new RetryPolicyFactory(configFactory.build(RetryPolicyConfig.class)), new ConcurrentHashMap<String, WorkerWrapper>(), new ConcurrentHashMap<String, TaskWrapper>(), strategy ); } }; } else if (config.getRunnerImpl().equals("local")) { taskRunnerFactory = new TaskRunnerFactory() { @Override public TaskRunner build() { final ExecutorService runnerExec = Executors.newFixedThreadPool(config.getNumLocalThreads()); return new LocalTaskRunner(taskToolbox, runnerExec); } }; } else { throw new IllegalStateException(String.format("Invalid runner implementation: %s", config.getRunnerImpl())); } } }

Target:
public void initializeTaskRunnerFactory() { if (taskRunnerFactory == null) { if (config.getRunnerImpl().equals("remote")) { taskRunnerFactory = new TaskRunnerFactory() { @Override public TaskRunner build() { final ScheduledExecutorService retryScheduledExec = Executors.newScheduledThreadPool( 1, new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("RemoteRunnerRetryExec--%d") .build() ); ScalingStrategy strategy; if (config.getStrategyImpl().equalsIgnoreCase("ec2")) { strategy = new EC2AutoScalingStrategy( new AmazonEC2Client( new BasicAWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey") ) ), configFactory.build(EC2AutoScalingStrategyConfig.class) ); } else if (config.getStorageImpl().equalsIgnoreCase("noop")) { strategy = new NoopScalingStrategy(); } else { throw new IllegalStateException( String.format( "Invalid strategy implementation: %s", config.getStrategyImpl() ) ); } return new RemoteTaskRunner( jsonMapper, configFactory.build(RemoteTaskRunnerConfig.class), curatorFramework, new PathChildrenCache(curatorFramework, indexerZkConfig.getAnnouncementPath(), true), retryScheduledExec, new RetryPolicyFactory(configFactory.build(RetryPolicyConfig.class)), strategy ); } }; } else if (config.getRunnerImpl().equals("local")) { taskRunnerFactory = new TaskRunnerFactory() { @Override public TaskRunner build() { final ExecutorService runnerExec = Executors.newFixedThreadPool(config.getNumLocalThreads()); return new LocalTaskRunner(taskToolbox, runnerExec); } }; } else { throw new IllegalStateException(String.format("Invalid runner implementation: %s", config.getRunnerImpl())); } } }