Skip to content

Conversation

njr-11
Copy link
Contributor

@njr-11 njr-11 commented Oct 11, 2021

This pull copies over the SPI from MicroProfile Context Propagation that allows for third-party providers of thread context. This will be necessary for propagation of CDI context, for example, to be handled by a third-party implementation, such as Weld, but driven by the implementor of the Jakarta Concurrency specification.

One of the main decisions to make in adding this is whether the SPI should allow for serializable thread context to enable the 4 ContextService.createContextualProxy methods that let you create contextual proxies that can be serialized and deserialized across JVMs. MicroProfile avoided the need for serializable thread context by excluding these methods. We could do that, too, by declaring that the combination of third-party thread context with the createContextualProxy methods is only valid if the interface types are not serializable. That could simplify things for providers of third-party context. It could also be limiting in scenarios such as persistent (EJB) timers and potentially batch that might use the ContextService to store contextual tasks and expect them to be able to run on another JVM. I'll start a discussion on the mailing list about this.

An update to the above - I joined a call with the CDI spec group about this SPI, and the feedback from them is a strong preference to leave out the serializable aspect. Serialization gets too confusing and complex as to the very limited number of scenarios in which it could actually work. I have updated this pull with a second commit that takes away the serialization/deserialization of context. If anyone would like to see what it looked like prior to that point, that can be seen with just the first commit.

Signed-off-by: Nathan Rauh nathan.rauh@us.ibm.com

@njr-11 njr-11 linked an issue Oct 11, 2021 that may be closed by this pull request
@njr-11 njr-11 force-pushed the 103-propagation-of-third-party-context-types branch from e424bb5 to 57649ac Compare October 12, 2021 13:12
@scottmarlow
Copy link

Hi @njr-11 during the platform call today, you mentioned that the TCK tests for this would include a (mock) implementation and tests that use the mock implementation. Does that sound correct?

Will there be a volunteer to add the tests to https://github.com/eclipse-ee4j/jakartaee-tck/tree/master/src/com/sun/ts/tests/concurrency?

Thanks,
Scott

@njr-11
Copy link
Contributor Author

njr-11 commented Oct 12, 2021

Hi @njr-11 during the platform call today, you mentioned that the TCK tests for this would include a (mock) implementation and tests that use the mock implementation. Does that sound correct?

Will there be a volunteer to add the tests to https://github.com/eclipse-ee4j/jakartaee-tck/tree/master/src/com/sun/ts/tests/concurrency?

Thanks, Scott

@scottmarlow Yes. TCK tests for this will include a mock implementation of the ThreadContextProvider SPI, along with the TCK tests themselves driving the Jakarta Concurrency API to depend upon the mock ThreadContextProvider having transferred the mock context type to the async task or action, just as was done in the MicroProfile TCK for the equivalent SPI that we prototyped there. The location of the Concurrency TCK will be different that what you stated because the TCK is currently being ported over to the Concurrency project. If the TCK were already fully ported, then it would have been possible to include the TCK tests under the same pull as the spec updates.

@njr-11 njr-11 force-pushed the 103-propagation-of-third-party-context-types branch from 93e1df9 to 84ecf4f Compare October 18, 2021 19:40
@njr-11
Copy link
Contributor Author

njr-11 commented Oct 18, 2021

rebased and resolved the merge conflict, which was that this pull and the latest both added a new section to the same spot at the end of the main documentation file.

@njr-11 njr-11 merged commit 8a40391 into jakartaee:master Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagation of third party context types/implementations
3 participants