<font size=2 face="sans-serif">As for the interceptors/decorators intercepting
calls, it is completely depending on the implementation of interceptors/decorators.
The interceptors/decorators might intercept the invocation or might just
call into the next one.</font>
<br>
<br><font size=2 face="sans-serif">e.g.</font>
<br><tt><font size=2>Given that INT1 has priority 10 and INT2 has priority
5, then the invocation order:<br>
would be:</font></tt>
<br><font size=2 face="sans-serif">If you just logging the method invocation
you would have INT2 -> INT1->real method</font>
<br>
<br><font size=2 face="sans-serif">From end user point of view, it is invoking
the INT2 and then INT1</font>
<br>
<br><font size=2 face="sans-serif">Therefore, I still think it makes more
sense to notify the observers with the lowest priority first. Interesting
to know what others think.</font>
<br>
<br>
<br><font size=2 face="sans-serif">Many thanks,<br>
Emily<br>
===========================<br>
Emily Jiang<br>
WebSphere Application Server, CDI Development Lead</font>
<br><font size=2 face="sans-serif"> <br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: +44 (0)1962 816278 Internal: 246278<br>
<br>
Email: emijiang@uk.ibm.com <br>
Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Martin Kouba <mkouba@redhat.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Emily Jiang/UK/IBM@IBMGB,
Antoine Sabot-Durand <antoine@sabot-durand.net></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">CDI Java EE Specification
<cdi-dev@lists.jboss.org></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">29/11/2016 09:59</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [cdi-dev]
Defining the order of event thru priority</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by:
</font><font size=1 face="sans-serif">cdi-dev-bounces@lists.jboss.org</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Dne 29.11.2016 v 10:44 Emily Jiang napsal(a):<br>
> I think differently. For Alternatives, the Alternative with the highest<br>
> value is picked, while the others are ignored. There is no so much<br>
> invoked sequentially.<br>
><br>
> However, for interceptors/decorators/events, they are chained.<br>
> Therefore, I think events should follow the same fashion as<br>
> interceptors/decorators, which is to follow the ascending order.<br>
<br>
Well, there is a big difference between interceptors/decorators and <br>
events - interceptors/decorators do intercept the invocation and may add
<br>
some logic before and after.<br>
<br>
Given that INT1 has priority 10 and INT2 has priority 5, then the chain
<br>
would be:<br>
<br>
INT1_BEFORE -> INT2_BEFORE -> INT2_AFTER -> INT1_AFTER<br>
<br>
So it somehow makes sense that the interceptor with HIGHEST priority is
<br>
the last one which is able to AFFECT the invocation result.<br>
<br>
For events the chain is simple:<br>
<br>
OBSERVER1 -> OBSERVER2 -> OBSERVER3<br>
<br>
><br>
> Many thanks,<br>
> Emily<br>
> ===========================<br>
> Emily Jiang<br>
> WebSphere Application Server, CDI Development Lead<br>
><br>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
> Phone: +44 (0)1962 816278 Internal: 246278<br>
><br>
> Email: emijiang@uk.ibm.com<br>
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
><br>
><br>
><br>
><br>
> From: Martin Kouba <mkouba@redhat.com><br>
> To: Antoine Sabot-Durand <antoine@sabot-durand.net>,
CDI Java EE<br>
> Specification <cdi-dev@lists.jboss.org><br>
> Date: 28/11/2016 12:10<br>
> Subject: Re: [cdi-dev] Defining the order
of event thru priority<br>
> Sent by: cdi-dev-bounces@lists.jboss.org<br>
> ------------------------------------------------------------------------<br>
><br>
><br>
><br>
> Dne 28.11.2016 v 11:43 Antoine Sabot-Durand napsal(a):<br>
>> Hi all,<br>
>><br>
>> In a recent discussion with Martin, I realized that the use of
@Priotiy<br>
>> is not consistent in CDI 1.2:<br>
>><br>
>> - For Interceptor and decorator the lowest value in @Priority
is first<br>
>> (def in interceptor spec and 8.2.1)<br>
>> - For Alternatives the Highest value in @Priroty is first (def
in 5.2.2)<br>
>><br>
>> Since we have these different interpretation of @Priority value
in the<br>
>> spec , we may find more consistent to change the definition of
event<br>
>> ordering with the @Priority annotation.<br>
>> Right now we have:<br>
>><br>
>> "Observers with smaller priority values are called first"<br>
>><br>
>> We may find more intuitive to change it to:<br>
>><br>
>> "Observers with higher priority values are called first"<br>
><br>
> I believe this one makes much more sense...<br>
> +1<br>
><br>
>><br>
>> It will remove the oxymoron effect of the sentence and align this<br>
>> ordering on @Alternative way of using @Priorty.<br>
>><br>
>> Wdyt?<br>
>><br>
>> Antoine<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cdi-dev mailing list<br>
>> cdi-dev@lists.jboss.org<br>
>> </font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size=2><br>
>><br>
>> Note that for all code provided on this list, the provider licenses<br>
> the code under the Apache License, Version 2<br>
> (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><tt><font size=2>http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size=2>).
For all other ideas<br>
> provided on this list, the provider waives all patent and other<br>
> intellectual property rights inherent in such information.<br>
>><br>
><br>
> --<br>
> Martin Kouba<br>
> Software Engineer<br>
> Red Hat, Czech Republic<br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> cdi-dev@lists.jboss.org<br>
> </font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size=2><br>
><br>
> Note that for all code provided on this list, the provider licenses
the<br>
> code under the Apache License, Version 2<br>
> (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><tt><font size=2>http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size=2>).
For all other ideas<br>
> provided on this list, the provider waives all patent and other<br>
> intellectual property rights inherent in such information.<br>
><br>
><br>
><br>
> Unless stated otherwise above:<br>
> IBM United Kingdom Limited - Registered in England and Wales with
number<br>
> 741598.<br>
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
<br>
-- <br>
Martin Kouba<br>
Software Engineer<br>
Red Hat, Czech Republic<br>
_______________________________________________<br>
cdi-dev mailing list<br>
cdi-dev@lists.jboss.org<br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size=2><br>
<br>
Note that for all code provided on this list, the provider licenses the
code under the Apache License, Version 2 (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><tt><font size=2>http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size=2>).
For all other ideas provided on this list, the provider waives all patent
and other intellectual property rights inherent in such information.<br>
<br>
</font></tt>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>