amrishlal commented on a change in pull request #7174: URL: https://github.com/apache/pinot/pull/7174#discussion_r687923335
########## File path: pinot-core/src/main/java/org/apache/pinot/core/periodictask/BasePeriodicTask.java ########## @@ -111,22 +126,49 @@ protected void setUpTask() { */ @Override public final void run() { - _running = true; + try { + // Don't allow a task to run more than once at a time. + _runLock.lock(); + _running = true; - if (_started) { - long startTime = System.currentTimeMillis(); - LOGGER.info("Start running task: {}", _taskName); - try { - runTask(); - } catch (Exception e) { - LOGGER.error("Caught exception while running task: {}", _taskName, e); + if (_started) { + long startTime = System.currentTimeMillis(); + LOGGER.info("Start running task: {}", _taskName); + try { + runTask(); + } catch (Exception e) { + LOGGER.error("Caught exception while running task: {}", _taskName, e); + } + LOGGER.info("Finish running task: {} in {}ms", _taskName, System.currentTimeMillis() - startTime); + } else { + LOGGER.warn("Task: {} is skipped because it is not started or already stopped", _taskName); } - LOGGER.info("Finish running task: {} in {}ms", _taskName, System.currentTimeMillis() - startTime); - } else { - LOGGER.warn("Task: {} is skipped because it is not started or already stopped", _taskName); + + _running = false; Review comment: Removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org