[cdi-dev] Async events. We need ideas to improve CDI-499

Mark Struberg struberg at yahoo.de
Tue Feb 10 03:13:25 EST 2015


Oh one more thing I found which is most probably broken or totally changes the behaviour

8.) All observers with transactionPhase != IN_PROGRESS

LieGrue,
strub




> On Tuesday, 10 February 2015, 8:58, Mark Struberg <struberg at yahoo.de> wrote:
> > Hi José!
> 
> Backward compatibility is perfectly fine with both approaches. People can use 
> BeanManager#fire() instead of the newly proposed BeanManager#fireAsync().
> 
> 
> My point is that many people will simply not be able to use fireAsync() because 
> as a framework developer you really need to code defensive. Without an explicit 
> opt-in on observer side fireAsync() can basically only be used in situations 
> where you _exactly_ know all your observers...
> 
> An own @Async annotation would also be nice as it could not only be used at 
> @Observes but also for @Event
> 
> @Inject
> @Async 
> 
> @Event
> 
> private Event<UserLoggedIn> userLoggedInEventSource;
> 
> 
> The benefit of an own @Async annotation over extending e.g. the @Event 
> annotation is that it would be perfectly backward compatible. This code would 
> also run on CDI-1.0 .. 1.2 containers (as all annotations which are not 
> available on the classpath will simply be ignored by the JVM.
> 
> LieGrue,
> strub
>



More information about the cdi-dev mailing list