[cdi-dev] [JBoss JIRA] (CDI-541) Ordering of async observers (vs sync observers) is not specified
Tomas Remes (JIRA)
issues at jboss.org
Thu Jul 16 02:20:03 EDT 2015
[ https://issues.jboss.org/browse/CDI-541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tomas Remes updated CDI-541:
----------------------------
Description:
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?
was:
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}
What will be the order in this case? First, Second, Third? First, Third, Second?
{quote}
@Priority is not defined for the async part, it just says
{quote}
I guess this is not explicitly stated anywhere. Is it? Ok so sync observers go first anytime so let's focus only on the async observers. I am adding one more @ObservesAsync to the game.
> 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
>
> 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.3.15#6346)
More information about the cdi-dev
mailing list