<font size=2 face="sans-serif">If I understand you question correctly,
the reason that the interceptor is not working is that it directly calls
the method instead of going through the proxy. It is a known feature. </font>
<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">Matej Novotny &lt;manovotn@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">Michael Remijan &lt;mjremijan@yahoo.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">weld-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">14/11/2016 08:49</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [weld-dev]
[cdi-dev] Think I found bug with interceptor</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">weld-dev-bounces@lists.jboss.org</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi,<br>
<br>
first of all let us take this conversation off the cdi list, as it is a
Weld related question (moving to weld-dev list).<br>
<br>
Now to your question(s)...<br>
<br>
If you could attach a tiny reproducer, this would probably be resolved
within minutes, so if you can send one, do so please.<br>
<br>
&gt; Now here's the problem, If I use this annotation on just a regular
method<br>
&gt; which I call myself, it DOES NOT work.<br>
<br>
This feels like very basic use case do I doubt it isn't working.<br>
What are the classes where you declare these methods?<br>
How to you obtain a reference to the bean which has `doSend` method?<br>
<br>
Again, reproducer would make all this very obvious and I could help you
quickly :)<br>
<br>
<br>
&gt; @Priority set on it and that works fine. But I've also tried setting<br>
&gt; &lt;interceptors&gt; in beans.xml<br>
<br>
@Priority enables in for whole application, while beans.xml for the given
bean archive.<br>
And you should not combine both approaches.<br>
<br>
<br>
Regards<br>
Matej<br>
<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Michael Remijan&quot; &lt;mjremijan@yahoo.com&gt;<br>
&gt; To: cdi-dev@lists.jboss.org<br>
&gt; Sent: Monday, November 14, 2016 5:43:27 AM<br>
&gt; Subject: [cdi-dev] Think I found bug with interceptor<br>
&gt; <br>
&gt; Greetings,<br>
&gt; <br>
&gt; I am using:<br>
&gt; <br>
&gt; &lt;dependency&gt;<br>
&gt; &lt;groupId&gt;org.jboss.weld.se&lt;/groupId&gt;<br>
&gt; &lt;artifactId&gt;weld-se-core&lt;/artifactId&gt;<br>
&gt; &lt;version&gt;3.0.0.Alpha15&lt;/version&gt;<br>
&gt; &lt;/dependency&gt;<br>
&gt; <br>
&gt; and I think I found a bug with the interceptors. I wanted to ask about
it<br>
&gt; first before I put it in Jira.<br>
&gt; <br>
&gt; Basically, the interceptor I have defined works great if I annotate
a method<br>
&gt; called by the CDI container, which in my case is an method observing
for an<br>
&gt; event. I have an ExceptionRetryInterceptor class and an ExceptionRetry<br>
&gt; annotation. If I annotate an observer method like this:<br>
&gt; <br>
&gt; @ExceptionRetry<br>
&gt; public void send(<br>
&gt; @Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt<br>
&gt; ) throws MessagingException, IOException {....}<br>
&gt; <br>
&gt; <br>
&gt; No problem, everything works fine. I can see the interceptor code
being<br>
&gt; called in my logs.<br>
&gt; <br>
&gt; Now here's the problem, If I use this annotation on just a regular
method<br>
&gt; which I call myself, it DOES NOT work. So if I refactor the above
example so<br>
&gt; the annotation is NOT on the observer method called by the container,
then<br>
&gt; the doSend() method below does NOT get wrapped by the interceptor:<br>
&gt; <br>
&gt; <br>
&gt; public void send(<br>
&gt; @Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt<br>
&gt; ) throws MessagingException, IOException {<br>
&gt; //....<br>
&gt; doSend();<br>
&gt; }<br>
&gt; <br>
&gt; @ExceptionRetry<br>
&gt; public void doSend() {....} // this method does not get wrapped by
the<br>
&gt; interceptor<br>
&gt; <br>
&gt; <br>
&gt; I'm trying to figure out why. My ExceptionRetryInterceptor class has
a<br>
&gt; @Priority set on it and that works fine. But I've also tried setting<br>
&gt; &lt;interceptors&gt; in beans.xml but the doSend(){...} method still
doesn't get<br>
&gt; wrapped.<br>
&gt; <br>
&gt; Any thoughts/help?<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <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 code<br>
&gt; 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 intellectual<br>
&gt; property rights inherent in such information.<br>
_______________________________________________<br>
weld-dev mailing list<br>
weld-dev@lists.jboss.org<br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><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>