6 Replies Latest reply on Aug 20, 2004 10:17 AM by bill.burke

    Mixin class at the class level


      1/Is there a way to apply a mixin class at the class level and not
      only at the instance level ?

      2/It looks like that the same mixin class can be instantiated more than
      once per instance based on class inheritance.

      For example :
      if the class A inherits from class B and both supposed to have attached the mixin class C,when I create an instance of A,two instances of C are created .Is is expected ?

      Rgds-Claude

        • 1. Re: Mixin class at the class level

          1) PER-VM and PER-Instance are supported. It would be per-class that would have to be supported.

          • 2. Re: How to listen for remote notifications?
            bill.burke

            addNotificationListener on an RMIAdaptor throws the following exception when adding the notification listener I put in my previous message:

            java.rmi.MarshalException: error marshalling arguments; nested exception is:
             java.io.NotSerializableException: be.ugent.pbackx.client.MyRMIListener
             at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
             at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
             at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
             at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
             at org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:58)
             at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:53)
             at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:55)
             at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
             at $Proxy1.addNotificationListener(Unknown Source)
             at be.ugent.pbackx.util.EJBUtil.addNotificationListener_aroundBody82(EJBUtil.java:143)
             at be.ugent.pbackx.util.EJBUtil.addNotificationListener_aroundBody84(EJBUtil.java:143)
             at be.ugent.pbackx.util.EJBUtil.addNotificationListener(EJBUtil.java)
             at be.ugent.pbackx.client.SimpleMonitorPanel.<init>(SimpleMonitorPanel.java:36)
             at be.ugent.pbackx.client.GUIManager.initComponents_aroundBody122(GUIManager.java:83)
             at be.ugent.pbackx.client.GUIManager.initComponents(GUIManager.java)
             at be.ugent.pbackx.client.GUIManager.initComponents_aroundBody0(GUIManager.java:26)
             at be.ugent.pbackx.client.GUIManager.<init>(GUIManager.java:26)
             at be.ugent.pbackx.client.GUIManager.main(GUIManager.java:171)
            Caused by: java.io.NotSerializableException: be.ugent.pbackx.client.MyRMIListener
             at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
             at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1224)
             at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1050)
             at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
             at org.jboss.invocation.MarshalledValue.<init>(MarshalledValue.java:57)
             at org.jboss.invocation.MarshalledInvocation.writeExternal(MarshalledInvocation.java:477)
             at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1264)
             at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
             at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
             at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
             at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:265)
             at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:124)
             ... 17 more
            


            Just for the record the complete MyRMIListener code:
            package be.ugent.pbackx.client;
            
            import org.jboss.jmx.adaptor.rmi.RMINotificationListener;
            
            public class MyRMIListener implements RMINotificationListener {
             public void handleNotification(javax.management.Notification notification, Object obj) {
             System.out.println("\nReceived notification: " + notification);
             }
            }
            


            • 3. Re: Mixin class at the class level
              bill.burke

              1) If you want a singleton mixin, then you can put anything you want in the construction XML element. So, the mixin reference can be set by calling a method or setting it to a singleton field of some class.

              2) Are you applying the introduction twice? How does C++ work? I want to model virtual inheritance of C++ so I guess I have to change the behavior. As a workaround, I guess you have to make sure that the introduction expression has a !$instanceof{MixinInterface}

              Bill

              • 4. Re: Mixin class at the class level

                1/OK for the workaround.
                Do u think that the scope for a Mixin class could not be supported
                at the infrastructure level ?(future version of JBOSS-AOP)

                2/ Thx .It does work...FYI ,the full expression for my user-case.


                • 5. Re: Mixin class at the class level
                  bill.burke

                  1) PER-VM and PER-Instance are supported. It would be per-class that would have to be supported.

                  • 6. Re: Mixin class at the class level

                    Any plan to support per class scope for Introduction in the near future ?
                    Thx Claude

                    FYI.,what Aspectwerkz does in this area :

                    <introduction-def name="mixin"
                    interface="examples.introduction.Mixin"
                    implementation="examples.introduction.MixinImpl"
                    deployment-model=perJVM | perClass | perInstance | perThread />