...
- Create an ThreadLocal storage (Context) with the following properties
a) Ignite node-independent
b) stores arbitrary attributes and their corresponding values
c) provides the ability to update attribute values
d) provides the ability to automatically undo the last Context update, restoring previous attribute values, after the corresponding operation completes
e) provides the ability to creates a snapshot of stored attributes and their values
f) provides the ability to restores attribute values from snapshot to Context in another thread
This will help create a unified mechanism for attaching arbitrary data to an operation for its duration, as well as the ability to move context attribute values between threads.
- Integrate the ability to capture Context Attributes values via snapshot creation into Thread Pool and Futures classes. It will require to create a special wrappers over existing classes.
Methods such as ExecutorSecvice#submit or IgniteFuture#listen should automatically capture and save the state of the Context along with the closure that could potentially be executed on another thread, and restore the saved Context before executing it.
The following Ignite and Java classes should be considered:
- IgniteThreadPoolExecutor
- StripedExecutor
- StripedThreadPoolExecutor
- ForkJoinPool
- ScheduledThreadPoolExecuror
- ForkJoinPool.commonPool
- GridFutureAdapter
- CompletableFuture
- Add special rules for the static code analyzer to prevent the use of multithreading-related classes that do not support automatic Context capture/restore. And support ability to exclude classes and and modules from this check - e.g. the mentioned check can be skipped for thin client related code.
...
{"serverDuration": 95, "requestCorrelationId": "31d85c5c7f887fbf"}