Skip to main content
  • Log in
  • Manage Cookies
projects.eclipse.org
Download
  • Projects
  • Working Groups
  • Members
  • Community
    • Marketplace
    • Events
    • Planet Eclipse
    • Newsletter
    • Videos
    • Blogs
  • Participate
    • Report a Bug
    • Forums
    • Mailing Lists
    • Wiki
    • IRC
    • Research
  • Eclipse IDE
    • Download
    • Learn More
    • Documentation
    • Getting Started / Support
    • How to Contribute
    • IDE and Tools
    • Newcomer Forum
  • More
      • Community

      • Marketplace
      • Events
      • Planet Eclipse
      • Newsletter
      • Videos
      • Blogs
      • Participate

      • Report a Bug
      • Forums
      • Mailing Lists
      • Wiki
      • IRC
      • Research
      • Eclipse IDE

      • Download
      • Learn More
      • Documentation
      • Getting Started / Support
      • How to Contribute
      • IDE and Tools
      • Newcomer Forum
    • Search

  1. Home
  2. Projects
  3. Eclipse Technology
  4. MicroProfile®
  5. Context Propagation 1.2
  6. Context Propagation 1.2 Release Review

MicroProfile® Context Propagation 1.2 Release Review

Type: 
Release
State: 
Successful
End Date of the Review Period: 

Reviews run for a minimum of one week. The outcome of the review is decided on this date. This is the last day to make comments or ask questions about this review.

Wednesday, March 10, 2021
Project: 
MicroProfile®
Release: 

Context Propagation 1.2

Description: 

MicroProfile Context Propagation 1.2 provides APIs for obtaining CompletableFutures that are backed by managed threads (threads that are managed by the container), with the ability to capture context from the thread that creates the CompletableFuture and apply it when running the CompletionStage action.  This enables CompletionStage actions to rely on having predictable thread context and enables users of these CompletionStages to guard against unintentional donation of thread context.

Example of ManagedExecutor, which contextualizes all dependent stages:

ManagedExecutor executor = ManagedExecutor.builder()
.propagated(ThreadContext.CDI, ThreadContext.APPLICATION)
.build();
...
CompletableFuture<Integer> stage = executor
.supplyAsync(supplier1)
.thenApplyAsync(function1)
.thenApply(function2);

Example of ThreadContext for granular contextualization of a single stage:

ThreadContext threadContext = ThreadContext.builder()
.propagated(ThreadContext.APPLICATION)
.cleared(ThreadContext.SECURITY, ThreadContext.TRANSACTION)
.unchanged(ThreadContext.ALL_REMAINING)
.build();
...
Function<Integer, Double> getItemCost = threadContext.contextualFunction(id -> {
// java:comp, java:module, java:app lookups require the application's context
DataSource ds = InitialContext.doLookup("java:app/env/jdbc/ds1");
...
});
unmanagedStage4 = unmanagedStage1.thenApply(getProductId)
.thenApply(getItemCost)
.thenApply(addToTotal);

Conforms To UI/UX Guidelines: 
Not verified
Links: 
Tracking issue
  • Sign in to post comments.

Project Links

  • MicroProfile Blog
  • MicroProfile Calendar
  • MicroProfile Resources
  • MicroProfile Working Group Project
  • Website
Incubating - MicroProfile®

Related Projects

Project Hierarchy:

  • Eclipse Technology
  • MicroProfile®

Tags

Technology Types
  • Cloud Native Java
Build Technologies
  • Maven

Eclipse Foundation

  • About Us
  • Contact Us
  • Sponsor
  • Members
  • Governance
  • Code of Conduct
  • Logo and Artwork
  • Board of Directors
  • Careers

Legal

  • Privacy Policy
  • Terms of Use
  • Copyright Agent
  • Eclipse Public License
  • Legal Resources

Useful Links

  • Report a Bug
  • Documentation
  • How to Contribute
  • Mailing Lists
  • Forums
  • Marketplace

Other

  • IDE and Tools
  • Projects
  • Working Groups
  • Research@Eclipse
  • Report a Vulnerability
  • Service Status

Copyright © Eclipse Foundation. All Rights Reserved.

Back to the top