[ 
https://issues.apache.org/jira/browse/IGNITE-26776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mikhail Petrov updated IGNITE-26776:
------------------------------------
    Description: 
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.
2. Create a custom wrapper over CompletableFuture that extends its behavior by 
capturing/restoring the operation context. And replace existing 
CompletableFuture usages with it.

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.  



> 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: 0.5h
>  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.
> 2. Create a custom wrapper over CompletableFuture that extends its behavior 
> by capturing/restoring the operation context. And replace existing 
> CompletableFuture usages with it.
> 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.  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to