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

Support Virtual Threads #147

Open
gastaldi opened this issue Dec 18, 2024 · 3 comments
Open

Support Virtual Threads #147

gastaldi opened this issue Dec 18, 2024 · 3 comments

Comments

@gastaldi
Copy link
Member

It would be nice if we could use unpinned virtual threads (if available/configured) as the WorkManager executor

@vsevel
Copy link
Contributor

vsevel commented Dec 18, 2024

Oh yes. And get consistency with respect to duplicated context. I think it does not work right now

@gastaldi
Copy link
Member Author

@vsevel you mean duplicated contexts in virtual threads or something specific? Got a reproducer?

@vsevel
Copy link
Contributor

vsevel commented Dec 18, 2024

we had this conversation some time ago in zulip or in an issue. the point was that the threads for the consumer were managed directly by the RA, and I was under the impression this was not easy to change, because (you said) the behavior was not specified by the spec (something like that?).
as a result some of the features were not available, such as the duplicated context. since I wanted to capture some context information (like I would have done in the old world with a thread local), I tried using a request scope. but this is not working with kafka consumers (but dup context is working).
so I have to use request scope for jms consumers, and dup context for everything else.
I just tried running a consumer. the current thread is ActiveMQ-client-global-threads, and ContextLocals.get("foo") will throw a java.lang.UnsupportedOperationException: Access to Context Locals are forbidden from a 'root' context as it can leak data between unrelated processing. Make sure the method runs on a 'duplicated' (local) Context
hopefully, supporting virtual threads for jms consumers would bring consistency with respect to duplicated context. but may be this is not the point.
regardless I think this is a very good idea.

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