Source:
<code>public void collect(final LoggingProtos.BatchLogMessage batchLogMessage) { <START> if (lastBlackListFetchDateTime.plusSeconds(REFRESH_PERIOD_MINUTES).isBeforeNow()){ <END> LOGGER.info("Refreshed sense black list"); senseBlackList = getSenseBlackList(); lastBlackListFetchDateTime = DateTime.now(DateTimeZone.UTC); } final BatchLog batchLog = chunkBatchLogMessage(batchLogMessage); documents.addAll(batchLog.documents); if (!indexes.containsKey(batchLog.createdDateString)){ IndexTankClient.Index newIndex = senseLogBackupIndex; final String indexName = senseLogIndexPrefix + batchLog.createdDateString; try { newIndex = indexTankClient.createIndex(indexName); Integer waitSeconds = 0; while (!isIndexReady(newIndex)) { waitSeconds += INDEX_CREATION_DELAY/1000; LOGGER.warn("Index is not ready, has been waiting for seconds", waitSeconds); if (waitSeconds >= 121) { LOGGER.error("Stop waiting on index creation. Opting out"); System.exit(1); } try { Thread.sleep(INDEX_CREATION_DELAY); } catch (InterruptedException e) { LOGGER.error("interrupted"); } } LOGGER.info("Index is ready to serve!", indexName); } catch (IndexAlreadyExistsException indexAlreadyExistsException) { LOGGER.info("Index already existed", indexName); newIndex = indexTankClient.getIndex(indexName); } catch (MaximumIndexesExceededException e) { LOGGER.error("Failed to create new index because ", indexName, e.getMessage()); } catch (IOException e) { LOGGER.error("Failed to create new index because ", indexName, e.getMessage()); } catch (UnexpectedCodeException e) { LOGGER.error("Failed to create new index because {}", indexName, e.getMessage()); } indexes.put(batchLog.createdDateString, newIndex); } index = indexes.get(batchLog.createdDateString); }</code><technical_language>plusSeconds adding REFRESH_PERIOD_MINUTES</technical_language>

Target:
public void collect(final LoggingProtos.BatchLogMessage batchLogMessage) { final BatchLog batchLog = chunkBatchLogMessage(batchLogMessage); documents.addAll(batchLog.documents); if (!indexes.containsKey(batchLog.createdDateString)){ IndexTankClient.Index newIndex = senseLogBackupIndex; final String indexName = senseLogIndexPrefix + batchLog.createdDateString; try { newIndex = indexTankClient.createIndex(indexName); Integer waitSeconds = 0; while (!isIndexReady(newIndex)) { waitSeconds += INDEX_CREATION_DELAY/1000; LOGGER.warn("Index is not ready, has been waiting for seconds", waitSeconds); if (waitSeconds >= 121) { LOGGER.error("Stop waiting on index creation. Opting out"); System.exit(1); } try { Thread.sleep(INDEX_CREATION_DELAY); } catch (InterruptedException e) { LOGGER.error("interrupted"); } } LOGGER.info("Index is ready to serve!", indexName); } catch (IndexAlreadyExistsException indexAlreadyExistsException) { LOGGER.info("Index already existed", indexName); newIndex = indexTankClient.getIndex(indexName); } catch (MaximumIndexesExceededException e) { LOGGER.error("Failed to create new index because ", indexName, e.getMessage()); } catch (IOException e) { LOGGER.error("Failed to create new index because ", indexName, e.getMessage()); } catch (UnexpectedCodeException e) { LOGGER.error("Failed to create new index because {}", indexName, e.getMessage()); } indexes.put(batchLog.createdDateString, newIndex); } index = indexes.get(batchLog.createdDateString); }