<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"> <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">Matej Novotny <manovotn@redhat.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Michael Remijan <mjremijan@yahoo.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">weld-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">14/11/2016 08:49</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</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:
</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>
> Now here's the problem, If I use this annotation on just a regular
method<br>
> 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>
> @Priority set on it and that works fine. But I've also tried setting<br>
> <interceptors> 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>
> From: "Michael Remijan" <mjremijan@yahoo.com><br>
> To: cdi-dev@lists.jboss.org<br>
> Sent: Monday, November 14, 2016 5:43:27 AM<br>
> Subject: [cdi-dev] Think I found bug with interceptor<br>
> <br>
> Greetings,<br>
> <br>
> I am using:<br>
> <br>
> <dependency><br>
> <groupId>org.jboss.weld.se</groupId><br>
> <artifactId>weld-se-core</artifactId><br>
> <version>3.0.0.Alpha15</version><br>
> </dependency><br>
> <br>
> and I think I found a bug with the interceptors. I wanted to ask about
it<br>
> first before I put it in Jira.<br>
> <br>
> Basically, the interceptor I have defined works great if I annotate
a method<br>
> called by the CDI container, which in my case is an method observing
for an<br>
> event. I have an ExceptionRetryInterceptor class and an ExceptionRetry<br>
> annotation. If I annotate an observer method like this:<br>
> <br>
> @ExceptionRetry<br>
> public void send(<br>
> @Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt<br>
> ) throws MessagingException, IOException {....}<br>
> <br>
> <br>
> No problem, everything works fine. I can see the interceptor code
being<br>
> called in my logs.<br>
> <br>
> Now here's the problem, If I use this annotation on just a regular
method<br>
> which I call myself, it DOES NOT work. So if I refactor the above
example so<br>
> the annotation is NOT on the observer method called by the container,
then<br>
> the doSend() method below does NOT get wrapped by the interceptor:<br>
> <br>
> <br>
> public void send(<br>
> @Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt<br>
> ) throws MessagingException, IOException {<br>
> //....<br>
> doSend();<br>
> }<br>
> <br>
> @ExceptionRetry<br>
> public void doSend() {....} // this method does not get wrapped by
the<br>
> interceptor<br>
> <br>
> <br>
> I'm trying to figure out why. My ExceptionRetryInterceptor class has
a<br>
> @Priority set on it and that works fine. But I've also tried setting<br>
> <interceptors> in beans.xml but the doSend(){...} method still
doesn't get<br>
> wrapped.<br>
> <br>
> Any thoughts/help?<br>
> <br>
> <br>
> <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
the code<br>
> 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 intellectual<br>
> 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>