amrishlal commented on a change in pull request #7174:
URL: https://github.com/apache/pinot/pull/7174#discussion_r684366753



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/periodictask/BasePeriodicTask.java
##########
@@ -87,13 +94,16 @@ public final synchronized void start() {
       LOGGER.warn("Task: {} is already started", _taskName);
       return;
     }
-    _started = true;
 
     try {
       setUpTask();
     } catch (Exception e) {
       LOGGER.error("Caught exception while setting up task: {}", _taskName, e);
     }
+
+    // mark _started as true only after state has completely initialized, so 
that run method doesn't end up seeing

Review comment:
       This class is used by multiple threads, so it's a good idea to make it 
thread safe irrespective of how it is used. The API shouldn't allow a situation 
where run method ends up being called on partially initialized state.




-- 
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

Reply via email to