Source:
<code>private void init(long maxIdleTimeForIndexerInSecs, long idleTimeCheckIntervalInSecs) throws IndexingException, URISyntaxException { IndexingSettingsGenerator settingsGeneratorForDefaultEnv = new IndexingSettingsGenerator(indexingProperties); IndexingSettingsGenerator settingsGeneratorForAnotherEnv = new IndexingSettingsGenerator(TargetIndexingEnvironment.ALTERNATIVE, indexingProperties); IndexingSettings indexingSettingsForPreviewDbInDefaultEnv = settingsGeneratorForDefaultEnv.generateForPreview(); IndexingSettings indexingSettingsForPublishDbInDefaultEnv = settingsGeneratorForDefaultEnv.generateForPublish(); IndexingSettings indexingSettingsForPreviewDbInAnotherEnv = settingsGeneratorForAnotherEnv.generateForPreview(); IndexingSettings indexingSettingsForPublishDbInAnotherEnv = settingsGeneratorForAnotherEnv.generateForPublish(); indexerPoolForPreviewDbInDefaultEnv = new IndexerPool(indexingSettingsForPreviewDbInDefaultEnv, <START> maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); <END> indexerPoolForPublishDbInDefaultEnv = new IndexerPool(indexingSettingsForPublishDbInDefaultEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); if (indexingSettingsForPreviewDbInAnotherEnv != null) { indexerPoolForPreviewDbInAnotherEnv = new IndexerPool(indexingSettingsForPreviewDbInAnotherEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); } if (indexingSettingsForPublishDbInAnotherEnv != null) { indexerPoolForPublishDbInAnotherEnv = new IndexerPool(indexingSettingsForPublishDbInAnotherEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); } }</code><technical_language>Duplication of code. this method instead private IndexerPool initIndexerPool(long maxIdleTimeForIndexerInSecs, long idleTimeCheckIntervalInSecs, IndexingSettings indexingSettingsForSpecificEnv) { return new IndexerPool(indexingSettingsForSpecificEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); }</technical_language>

Target:
private void init(long maxIdleTimeForIndexerInSecs, long idleTimeCheckIntervalInSecs) throws IndexingException, URISyntaxException { IndexingSettingsGenerator settingsGeneratorForDefaultEnv = new IndexingSettingsGenerator(indexingProperties); IndexingSettingsGenerator settingsGeneratorForAnotherEnv = new IndexingSettingsGenerator(TargetIndexingEnvironment.ALTERNATIVE, indexingProperties); IndexingSettings indexingSettingsForPreviewDbInDefaultEnv = settingsGeneratorForDefaultEnv.generateForPreview(); IndexingSettings indexingSettingsForPublishDbInDefaultEnv = settingsGeneratorForDefaultEnv.generateForPublish(); IndexingSettings indexingSettingsForPreviewDbInAnotherEnv = settingsGeneratorForAnotherEnv.generateForPreview(); IndexingSettings indexingSettingsForPublishDbInAnotherEnv = settingsGeneratorForAnotherEnv.generateForPublish(); indexerPoolForPreviewDbInDefaultEnv = initIndexerPool(indexingSettingsForPreviewDbInDefaultEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); indexerPoolForPublishDbInDefaultEnv = initIndexerPool(indexingSettingsForPublishDbInDefaultEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); if (indexingSettingsForPreviewDbInAnotherEnv != null) { indexerPoolForPreviewDbInAnotherEnv = initIndexerPool(indexingSettingsForPreviewDbInAnotherEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); } if (indexingSettingsForPublishDbInAnotherEnv != null) { indexerPoolForPublishDbInAnotherEnv = initIndexerPool(indexingSettingsForPublishDbInAnotherEnv, maxIdleTimeForIndexerInSecs, idleTimeCheckIntervalInSecs); } }