Skip to content

Context Aware Concurrency

All Submissions:

  • [YES] I have added an explanation of what changes in this merge do and why we should include it?
  • [NO] Does the MR contain pipeline/ helm chart related changes?
  • [NO] I have updated the documentation accordingly.
  • [YES] I have added tests to cover my changes.
  • [YES] All new and existing tests passed.
  • [YES] My code follows the code style of this project.
  • [YES] I ran lint checks locally prior to submission.

What is the issue or story related to the change?

High level design: Create custom classes for concurrency which extend logic from classes in java.util.concurrency package but ensure that the MDC and request context is copied from main thread to child threads.

Issue: To handle concurrency in our services, we make use of java.util.concurrency package. This package contains classes like ExecutorService which handle the thread pool for us and execute Runnable objects in new threads. The implementation is such that thread context is not copied from main thread to child threads, and we lose the MDC context map and other request attributes in the child threads.

Change details:

Test coverage:

Added unit tests for CustomExecutors and CustomThreadPoolExecutorUtil.

Does this introduce a breaking change?

  • NO

Pending items

Upcoming MR in storage service to add CustomThreadPoolFactory - osdu/platform/system/storage!126 (merged)

Reviewer request

  • Please provide an ETA when you plan to review this MR. Write a comment to decline or provide an ETA.
  • Block the MR if you feel there is less testing or no details in the MR
  • Please cover the following aspects in the MR -- Coding design: <Reviewer1> -- Backward Compatibility: <Reviewer2> -- Feature Logic: <Logic design> -- <Any other context mention here> OR -- <Component 1>: <Reviewer1> -- <CosmosDB>: <Reviewer2> -- <ServiceBus> <Reviewer3> -- <Mention any other component and owner>

Other information

Edited by Vibhuti Sharma [Microsoft]

Merge request reports