JBoss Community

calling aspect from netty thread inside jboss 5.1

created by Gabriel Bermudez in JBoss AOP - View the full discussion

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

Start a new discussion in JBoss AOP at Community