ptupitsyn commented on a change in pull request #8870:
URL: https://github.com/apache/ignite/pull/8870#discussion_r599321512



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
##########
@@ -68,7 +80,10 @@ public IgniteFutureImpl(IgniteInternalFuture<V> fut) {
     @Override public void listen(IgniteInClosure<? super IgniteFuture<V>> 
lsnr) {
         A.notNull(lsnr, "lsnr");
 
-        fut.listen(new InternalFutureListener(lsnr));
+        if (defaultExecutor != null && !isDone())
+            fut.listen(new InternalFutureListener(new 
AsyncFutureListener<>(lsnr, defaultExecutor)));
+        else
+            fut.listen(new InternalFutureListener(lsnr));

Review comment:
       Some async operations complete synchronously, like `cache.get` on a 
primary key. In this case we run the continuation immediately on the current 
user thread - no need to schedule it somewhere else.
   
   ```
   // Key 1 is available locally (primary or backup)
   // Striped pool is not involved, cache operation and doSomething are 
executed on the current thread
   cache.get(1).listen(doSomething) 
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to