[cdi-dev] On @Observes for async events

Pete Muir pmuir at redhat.com
Thu Mar 19 07:08:40 EDT 2015


Good points, I will mull on it :-)

> On 19 Mar 2015, at 06:25, Mark Struberg <struberg at yahoo.de> wrote:
> 
>>> but opposed to ee concurrency utilities
>> 
>> I thought this was by mistake rather than design?
> 
> 
> 
> As far as I remember there was a long discussion on the EJB EG and it was intentionally that @Asynchronous does NOT propagate any information about the session, security, and don’t even share the same pool instance from @Stateless (pool ~what we have as @RequestScoped).
> 
> The reason is that EJB is all about removing concurrency complexity from the user as good as possible. The other problem is that you don’t have it under control how long the new thread will run. And the Session might be looong time dead already. Another issue is with TX handling. The JPA spec and also JTA spec (TransactionSynchronizationRegistry) defines that a transaction must not be used ‚concurrently‘. Means they only must be assigned to a very single Thread.
> 
> Even with servlet 3.0 async requests you have a ServletRequest only attached to a very single thread AT EACH TIME (means the thread might switch, but it’s max 1 at a time). 
> 
> 
> 
> LieGrue,
> strub




More information about the cdi-dev mailing list