[
https://issues.jboss.org/browse/CDI-541?page=com.atlassian.jira.plugin.sy...
]
Matej Novotny commented on CDI-541:
-----------------------------------
If I get this correctly then setting different @Priority to async observers will result in
one observer being notified later than the other (as in the example given above). But
there is not really a way to tell that the async observer has finished its work hence I
cannot rely on its job being finished (the underlaying data being changed for instance)
while the other observer is already executing.
Now the question I have - could you give me a scenario when I would need to have one
observer notified later than the other while still not caring about the data they handle
(not relying on when they are done executing)? And I mean a scenario which wouldn't
end all the same when using async observers without @Priority.
Obviously, there might be some but I just cannot see any atm so feel free to enlighten me
:)
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
Priority: Major
Fix For: 2.0-EDR2
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
(v6.4.11#64026)