AMashenkov commented on a change in pull request #9544:
URL: https://github.com/apache/ignite/pull/9544#discussion_r740110289
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/BusyExecutor.java
##########
@@ -119,12 +150,40 @@ 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;
+ }
+
+ /**
+ * Submit cancellable task to execute in thread pool.
+ *
+ * @param ct Task to execute.
+ * @return Completable future with executed flag in result.
+ */
+ public CompletableFuture<Boolean> submit(CancellableTask ct) {
+ GridBusyLock lock = busyLock;
+
CompletableFuture<Boolean> res = new CompletableFuture<>();
+
+ if (busyRun(() -> cancellableTasks.put(ct, ct), lock)) {
Review comment:
```suggestion
if (cancellableTasks.put(ct, ct), lock)) {
```
--
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]