[jboss-user] [JBoss AOP] - calling aspect from netty thread inside jboss 5.1

Gabriel Bermudez do-not-reply at jboss.com
Mon Jun 28 19:44:09 EDT 2010


Gabriel Bermudez [http://community.jboss.org/people/elgabo] created the discussion

"calling aspect from netty thread inside jboss 5.1"

To view the discussion, visit: http://community.jboss.org/message/550087#550087

--------------------------------------------------------------
Hi,

We are using netty to send and receive network messages.  But for some reason advices are not being called when messages are received.

All classes and xml files involved on the project are _not_ inside the same jar, basically I have 2  jar, basic.jar with common code like the aspect, the jboss-beans.xml  file where the netty SocketChannelFactory is defined (a exact copy of  the file found inside netty.jar/META-INF/jboss-beans.xml) and other  common beans defined inside jboss-beans.xml file

basic.jar
+com.test.* (common classes)
+com.test.TestAspect
+META-INF
     +jboss-beans.xml
     +netty-jboss-beans.xml

And network.jar with  network specific code like MyNetworkListener, netty ChannleHandlers, and  of course the jboss-beans.xml file that defines beans and aspects

network.jar
+com.test.MyNetworkListener
+META-INF
     +jboss-beans.xml

For example I have the following aspect:

public class TestAspect {
   createSomething(MethodInvocation inv) {...}
   updateSomething(MethodInvocation inv) {...}
}

updateSomething must be called after a message is received from network so inside jboss-beans.xml I put

<aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
        xsi:schemaLocation="urn:jboss:aop-beans:1.0 aop-beans_1_0.xsd"
        class="com.test.TestAspect" name="TestAspect"/>

<aop:bind xmlns:aop="urn:jboss:aop-beans:1.0"
        xsi:schemaLocation="urn:jboss:aop-beans:1.0 aop-beans_1_0.xsd"
        pointcut="execution(public void com.test.MyNetworkListener->responseReceived(..))">
        <aop:after aspect="TestAspect" name="updateSomething"/>
</aop:bind>

the MyNetworkListener.responseReceived method is called by a netty ChannelHandler (obviosly running inside a IO thread) so I'm guessing that MyNetworkListener is not being weived properly because is being called from a thread not managed by the jboss server/aop libs? or maybe is a classloading issue?

Thanks for your help on this issue

Regards,

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/550087#550087]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100628/817fa806/attachment.html 


More information about the jboss-user mailing list