[cdi-dev] @ThreadScoped?

Romain Manni-Bucau rmannibucau at gmail.com
Tue Mar 8 08:43:10 EST 2016

Hi guys,

following request scope thread and to center the discussion on the thread
safety part: do we work on this?

Background: @RequestScoped is often used as a ThreadLocal instance
solution. A lot of SE or Batch implementations rely on it from what I saw
as well as async implementations reusing existing business logic with this
thread safety constraint.

Proposal: providing a @ThreadScoped implementation is cheap for CDI and
implemenation and would avoid the headache we can have with @RequestScoped.
Will also remove the quite dark side of the spec regarding servlet request
and request scope since now we would have a more natural solution for all
of these situation so @RequestScoped goals wouldn't collide as much.

- is it automatically started as request scoped is (JMS, @Async, ...)?
Alternative could be some configuration in beans.xml (merged accross the


- start/stop API (this is typically an API the user should be able to
control for its own threads)
- CDI 2.*0*?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160308/5275d46a/attachment.html 

More information about the cdi-dev mailing list