[
https://issues.apache.org/jira/browse/IGNITE-26776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mikhail Petrov resolved IGNITE-26776.
-------------------------------------
Resolution: Fixed
> Replace all uses of Futures with thread context aware equivalents.
> ------------------------------------------------------------------
>
> Key: IGNITE-26776
> URL: https://issues.apache.org/jira/browse/IGNITE-26776
> Project: Ignite
> Issue Type: Task
> Reporter: Mikhail Petrov
> Assignee: Mikhail Petrov
> Priority: Major
> Labels: IEP-143, ise
> Fix For: 2.19
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> According to IEP-143 Unified Operation Context Propagation, operation context
> propagation must be integrated into the Futures used in the Ignite codebase.
> Futures must automatically capture an Operation Context snapshot during
> listener/continuation registration and restore it during
> listener/continuation execution.
> This forces us to restrict the usage of built-in JDK Futures implementations
> and replace them with Ignite-specific implementations that support the
> Context Propagation feature.
> The control over class usage restriction must be implemented as a rule for
> the static code analyzer.
> The following Future implementations should be considered:
> • GridFutureAdapter and inherited classes
> • CompletableFuture
> GridFutureAdapter is custom Future implementation that widely used across the
> project.
> Adding support for the Operations Context propagation to the
> GridFutureAdapter is trivial.
> To cover CompletableFuture case two approaches can be considered:
> 1. Completely restrict usage of CompleatableFuture in the project. Replace
> existing usages with GridFutureAdapter. If GridFutureAdapter lacks any
> CompletableFuture functionality - implement it.
> The downside is that newly implemented features may introduce bugs and
> require thorough testing.
> 2. Create a custom wrapper over CompletableFuture that extends its behavior
> by capturing/restoring the operation context. And replace existing
> CompletableFuture usages with it.
> This approach is less risky because it reuses JDK Future logic.
> The problem with this approach is that CompletableFuture creates new instance
> each time new continuation is registered. And each instance should be
> wrapped. That may stress GC if overused.
> After private discussion, the second approach was considered preferable.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)