[
https://issues.jboss.org/browse/CDI-541?page=com.atlassian.jira.plugin.sy...
]
Martin Kouba commented on CDI-541:
----------------------------------
Well, the whole idea of observers ordering is against the principle of loose coupling.
However, the EG already decided to standardize it. In my opinion, it doesn't really
matter whether we sort sync or async observers. Note that the only requirement of
{{fireAsync()}} is: return immediately and notify observers asynchronously (we don't
define when, where and how).
We could also state that async observer with priority results in "non-portable
behavior" and let the implementations provide experimental support (e.g. by means of
[
NotificationOptions|https://github.com/cdi-spec/cdi/pull/337]).
Ordering of async observers (vs sync observers) is not specified
----------------------------------------------------------------
Key: CDI-541
URL:
https://issues.jboss.org/browse/CDI-541
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Events
Affects Versions: 2.0-EDR1
Reporter: Tomas Remes
Fix For: 2.0 .Final
I think this needs to be specified. E.g. what happens if I fire async event and have more
matching sync and async observers? Are all sync observes called first in given order with
no regard to async observers priority?
For example:
{{event.fireAsync(new Message());}}
{code}
public class First {
void observeMessage(@Observes @Priority(2000) Message message){}
}
{code}
{code}
public class Second {
void observeMessage(@ObservesAsync @Priority(2100) Message message){}
}
{code}
{code}
public class Third {
void observeMessage(@Observes @Priority(2200) Message message){}
}
{code}
{code}
public class Fourth {
void observeMessage(@ObservesAsync @Priority(2300) Message message){}
}
{code}
What will be the order in this case? First, Third, Second, Fourth?
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)