Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrency: add SPI for context providers #16

Closed
FroMage opened this issue Aug 13, 2018 · 2 comments
Closed

concurrency: add SPI for context providers #16

FroMage opened this issue Aug 13, 2018 · 2 comments

Comments

@FroMage
Copy link

FroMage commented Aug 13, 2018

In order for mp-concurrency to replace Reactive Contexts which is currently used by RESTEasy to provide context propagation, we need to be able to define context providers via an SPI. Otherwise, context providers would be a fixed list and not support contexts that are external to MP/EE.

This can be as simple as defining a ContextProvider interface which supports:

  • capturing a context
  • setting a context
  • restoring a context (in RESTEasy setting and restoring are different operations because the context is a stack with push/pop)

Where "the context" can be an opaque type that nobody outside of the context provider cares about (a type parameter would do).

Implementations of the ContextProvider can be listed with a META-INF/services file.

@njr-11
Copy link
Contributor

njr-11 commented Aug 13, 2018

To the best of my knowledge, the ThreadContextProvider SPI under pull #15 covers all of the above requirements and is conducive to context implementations that are stack-based as well as those that are not. The doc additions under that pull also specify that the ServiceLoader (META-INF/services) is the way to plug in a third-party provider. Can we close this issue if you are satisfied that everything is covered there?

@FroMage
Copy link
Author

FroMage commented Aug 14, 2018

Yes, now that #15 has been merged, it appears to support this use-case. Thanks.

@FroMage FroMage closed this as completed Aug 14, 2018
chyt added a commit to chyt/microprofile-sandbox that referenced this issue Jun 3, 2019
chyt added a commit to chyt/microprofile-sandbox that referenced this issue Jun 3, 2019
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

No branches or pull requests

2 participants