[cdi-dev] [JBoss JIRA] (CDI-31) Asynchronous events
Mark Struberg (JIRA)
jira-events at lists.jboss.org
Thu Apr 12 02:41:48 EDT 2012
[ https://issues.jboss.org/browse/CDI-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683358#comment-12683358 ]
Mark Struberg commented on CDI-31:
----------------------------------
Well, from a design perspective the current event is more like a method invocation with targets which are unknown to the caller. Thus they are atm perfectly fine to collect data from the @Observer methods.
That might also be possible if using asynchronous events. But in that case the event object would need to support multiple concurrency (which is not defined atm). Thus we cannot simply enable this in a backward compatible fashion. We would need to add a new annotation or new member value in @Observes or with the Event<T> source / EntityManager#fire(), e.g.
public enum ObserverType {
SYNCHRONOUS,
ASYNC_WAIT,
ASYNC_NOWAIT
}
Please be aware that both async methods have implications to the environment. We would e.g. need to limit the max number of Event-threads to spawn, otherwise we will quickly kill our Server.
But don't expect wonders! I'd say that in 99% of the cases the overhead to start and manage those threads is bigger than the costs of invoking all events synchronously...
ASYNC_NOWAIT (similar to @Asynchronous EJBs) is btw pretty dangerous as it is NOT relyable, must not share Session and Request Contexts, etc!
> Asynchronous events
> -------------------
>
> Key: CDI-31
> URL: https://issues.jboss.org/browse/CDI-31
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events
> Affects Versions: 1.0
> Reporter: Nicklas Karlsson
> Fix For: TBD
>
>
> Consider including asynchronous events as their were specified in one of the previous drafts.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the cdi-dev
mailing list