Berkof commented on a change in pull request #9314:
URL: https://github.com/apache/ignite/pull/9314#discussion_r699259322
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/StatisticsGatherer.java
##########
@@ -272,11 +272,18 @@ public void stop() {
if (log.isTraceEnabled())
log.trace(String.format("Statistics gathering stopping %d
task...", gatheringInProgress.size()));
- gatheringInProgress.values().forEach(ctx ->
ctx.futureGather().cancel(true));
-
- gatheringInProgress.clear();
+ cancelAllTasks();
if (log.isDebugEnabled())
log.debug("Statistics gathering stopped.");
}
+
+ /**
+ * Cancel all currently running statistics gathering tasks.
+ */
+ public void cancelAllTasks() {
+ gatheringInProgress.values().forEach(ctx ->
ctx.futureGather().cancel(true));
+
+ gatheringInProgress.clear();
+ }
Review comment:
It won't totally fix the possibility of failure cause we can change
state during processObsolescence execution. But I move state check directly
into it to improve readability and lower this chance a bit.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]