<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 -&gt; INT1-&gt;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">&nbsp;<br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: &nbsp;+44 (0)1962 816278 &nbsp;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: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Martin Kouba &lt;mkouba@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Emily Jiang/UK/IBM@IBMGB,
Antoine Sabot-Durand &lt;antoine@sabot-durand.net&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">CDI Java EE Specification
&lt;cdi-dev@lists.jboss.org&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">29/11/2016 09:59</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</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: &nbsp; &nbsp;
&nbsp; &nbsp;</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>
&gt; I think differently. For Alternatives, the Alternative with the highest<br>
&gt; value is picked, while the others are ignored. There is no so much<br>
&gt; invoked sequentially.<br>
&gt;<br>
&gt; However, for interceptors/decorators/events, they are chained.<br>
&gt; Therefore, I think events should follow the same fashion as<br>
&gt; 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 -&gt; INT2_BEFORE -&gt; INT2_AFTER -&gt; 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 -&gt; OBSERVER2 -&gt; OBSERVER3<br>
<br>
&gt;<br>
&gt; Many thanks,<br>
&gt; Emily<br>
&gt; ===========================<br>
&gt; Emily Jiang<br>
&gt; WebSphere Application Server, CDI Development Lead<br>
&gt;<br>
&gt; MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
&gt; Phone: &nbsp;+44 (0)1962 816278 &nbsp;Internal: 246278<br>
&gt;<br>
&gt; Email: emijiang@uk.ibm.com<br>
&gt; Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; From: &nbsp; &nbsp; &nbsp; &nbsp;Martin Kouba &lt;mkouba@redhat.com&gt;<br>
&gt; To: &nbsp; &nbsp; &nbsp; &nbsp;Antoine Sabot-Durand &lt;antoine@sabot-durand.net&gt;,
CDI Java EE<br>
&gt; Specification &lt;cdi-dev@lists.jboss.org&gt;<br>
&gt; Date: &nbsp; &nbsp; &nbsp; &nbsp;28/11/2016 12:10<br>
&gt; Subject: &nbsp; &nbsp; &nbsp; &nbsp;Re: [cdi-dev] Defining the order
of event thru priority<br>
&gt; Sent by: &nbsp; &nbsp; &nbsp; &nbsp;cdi-dev-bounces@lists.jboss.org<br>
&gt; ------------------------------------------------------------------------<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Dne 28.11.2016 v 11:43 Antoine Sabot-Durand napsal(a):<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; In a recent discussion with Martin, I realized that the use of
@Priotiy<br>
&gt;&gt; is not consistent in CDI 1.2:<br>
&gt;&gt;<br>
&gt;&gt; - For Interceptor and decorator the lowest value in @Priority
is first<br>
&gt;&gt; (def in interceptor spec and 8.2.1)<br>
&gt;&gt; - For Alternatives the Highest value in @Priroty is first (def
in 5.2.2)<br>
&gt;&gt;<br>
&gt;&gt; Since we have these different interpretation of @Priority value
in the<br>
&gt;&gt; spec , we may find more consistent to change the definition of
event<br>
&gt;&gt; ordering with the @Priority annotation.<br>
&gt;&gt; Right now we have:<br>
&gt;&gt;<br>
&gt;&gt; &quot;Observers with smaller priority values are called first&quot;<br>
&gt;&gt;<br>
&gt;&gt; We may find more intuitive to change it to:<br>
&gt;&gt;<br>
&gt;&gt; &quot;Observers with higher priority values are called first&quot;<br>
&gt;<br>
&gt; I believe this one makes much more sense...<br>
&gt; +1<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; It will remove the oxymoron effect of the sentence and align this<br>
&gt;&gt; ordering on @Alternative way of using @Priorty.<br>
&gt;&gt;<br>
&gt;&gt; Wdyt?<br>
&gt;&gt;<br>
&gt;&gt; Antoine<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; cdi-dev mailing list<br>
&gt;&gt; cdi-dev@lists.jboss.org<br>
&gt;&gt; </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>
&gt;&gt;<br>
&gt;&gt; Note that for all code provided on this list, the provider licenses<br>
&gt; the code under the Apache License, Version 2<br>
&gt; (</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>
&gt; provided on this list, the provider waives all patent and other<br>
&gt; intellectual property rights inherent in such information.<br>
&gt;&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Martin Kouba<br>
&gt; Software Engineer<br>
&gt; Red Hat, Czech Republic<br>
&gt; _______________________________________________<br>
&gt; cdi-dev mailing list<br>
&gt; cdi-dev@lists.jboss.org<br>
&gt; </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>
&gt;<br>
&gt; Note that for all code provided on this list, the provider licenses
the<br>
&gt; code under the Apache License, Version 2<br>
&gt; (</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>
&gt; provided on this list, the provider waives all patent and other<br>
&gt; intellectual property rights inherent in such information.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number<br>
&gt; 741598.<br>
&gt; 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>