<div dir="ltr">sounds like a quick and dirty solution to me. @Async will arrive - maybe too early today - but adding @ObservesAsync just cause we dont have yet @Async will make this API obselete pretty quickly isn't it (already cause of EJB actually).<div><br></div><div>Do we really want this feature at this price? If yes <b style="font-size:12.8000001907349px">AsyncObserves </b><span style="font-size:12.8000001907349px">sounds an acceptable compromise but still will mess up the API IMO.</span></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br><span style="font-size:small">Romain Manni-Bucau</span><br><a href="https://twitter.com/rmannibucau" target="_blank">@rmannibucau</a> | <a href="http://rmannibucau.wordpress.com" target="_blank">Blog</a> | <a href="https://github.com/rmannibucau" target="_blank">Github</a> | <a href="https://www.linkedin.com/in/rmannibucau" target="_blank">LinkedIn</a> | <a href="http://www.tomitribe.com" target="_blank">Tomitriber</a></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2015-03-19 15:36 GMT+01:00 Antoine Sabot-Durand <span dir="ltr"><<a href="mailto:antoine@sabot-durand.net" target="_blank">antoine@sabot-durand.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi guys,<div><br></div><div><br></div><div>So it seems impossible to avoid opt-in on the observer side for the sake of awkward compatibility.</div><div>Adding a member to @Observes could also be a source of issues when old CDI lib will be used with CDI 2.0 runtime. Some of us (including me) don’t want to add an @Async annotation to CDI spec, so perhaps we should add an async alternative to @Observes with an @AsyncObserves or @ObservesAsync ?</div><div><br></div><div><div>So it would be</div><div><br></div><div>public void myObserver(<b>@AsyncObserves</b> payload) {}</div><div><br></div><div>instead of</div><div><br></div><div><b>@Async</b></div><div>public void myObserver(@Observes payload) {}</div></div><div><br></div><div><br></div><div>Pros :</div><div>- it’s a cleaner way to manage the opt-in than to put 2 annotations or add a member to an existing one</div><div>- it could have new members related to async behavior (context propagation, concurrent scenario, etc…)</div><div>- As it won’t be in legacy code no risk to see old observers called asynchronously </div><div><br></div><div>Cons :</div><div>- Still not clear for users when fire() is called to see @AsyncObserves launched synchronously</div><div>- Yet another annotation added</div><div><br></div><div>wdyt ?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Antoine</div></font></span></div><br>_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br></blockquote></div><br></div>