AMashenkov commented on a change in pull request #9544:
URL: https://github.com/apache/ignite/pull/9544#discussion_r748029065
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/BusyExecutor.java
##########
@@ -119,12 +150,36 @@ public boolean busyRun(Runnable r) {
* Task surrounded with try/catch and if it's complete with any exception
- resulting future will return
*
* @param r Task to execute.
- * @return Completable future.
+ * @return Completable future with executed flag in result.
*/
public CompletableFuture<Boolean> submit(Runnable r) {
+ GridBusyLock lock = busyLock;
+
+ CompletableFuture<Boolean> res = new CompletableFuture<>();
+
+ pool.execute(() -> res.complete(busyRun(r, lock)));
+
+ return res;
Review comment:
```suggestion
GridBusyLock lock = busyLock;
CompletableFuture<Boolean> res = new CompletableFuture<>();
if (r instanceOf CancellableTask) {
res = res.thenApply(() -> cancellableTasks.remove(ct));
cancellableTasks.add(ct)
}
pool.execute(() -> res.complete(busyRun(r, lock)));
return res;
```
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/BusyExecutor.java
##########
@@ -135,6 +194,25 @@ public boolean busyRun(Runnable r) {
* @param r Task to execute.
*/
public void execute(Runnable r) {
- pool.execute(() -> busyRun(r));
+ GridBusyLock lock = busyLock;
+
+ pool.execute(() -> busyRun(r, lock));
Review comment:
I'd say
-2 methods (26 lines of code) that bring no value
+1 light object. it doen't look like it is not on hot path.
--
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]