Description
Problem
We allow users to pass continuations to IgniteFuture which will be executed on future completion. This can be done through listen or chain methods.
However, continuation semantics is broken intrinsically:
1) If future is already completed, user code executed in the same thread;
2) If future is not completed yet, it will be executed in completion thread.
Neither of this options are valid because it easily leads to starvation. E.g.:
IgniteFuture fut = cache.getAsync(key2);
fut.listen(fut0 -> {
cache.put(key2, val2); // Possible deadlock, because invoked in sys pool;
});
Solution
1) By default callbacks must be executed asynchronously in some common pool (public pool? new "callback pool"? FJP?)
2) It should be possible to specify where to execute a callback explicitly:
IgniteFuture.listen(IgniteClosure, ExecutorService);
3) We may want to expose our public pool on API for convenience.
Attachments
Issue Links
- duplicates
-
IGNITE-1650 Add ability to specify thread pool for IgniteFuture listen/chain methods.
- Closed
- is related to
-
IGNITE-12033 Callbacks from striped pool due to async/await may hang cluster
- Resolved
-
IGNITE-4475 Simplify async API
- Resolved
-
IGNITE-4476 GridIoManger must always process messages asynchronously
- Closed
- links to