3 Replies Latest reply on Aug 14, 2005 7:00 AM by Kabir Khan

    Advised classes after serialization

    Tim Fox Master

      Hi All-

      In JBoss Messaging the JMS facade functionality is mainly provided by a set of client side interceptors and a set of server side interceptors that intercept all calls to the JMS API as they travel from JMS client to JMS server.

      Currently the interceptor stacks are implemented using dynamic proxies (i.e. "old style"), but we're considering refactoring them so they're implemented using JBoss AOP to advise the client class with an interceptor stack.

      We don't want to have any configuration data (e.g. jboss-aop.xml) on the jms client side. So if we were to do this we would want to advise the class on the server side and serialize the advised class back to the client side where it can be used.

      My question is this:

      Are JBoss AOP advised classes still valid (i.e. are they still advised) after being serialized from one JVM to another? Do the advice scopes (PER_VM, PER_CLASS, PER_INSTANCE, PER_VM) still hold?

      E.g. If we advise a class with some PER_VM advice then serialize two instances of it to another JVM, then on deserialization do we only have one instance of the advice?

      Is there anything else we should watch out for with an approach like this?



        • 1. Re: Advised classes after serialization
          Kabir Khan Master

          I must confess I am a bit shaky on this point, but serialization of advised classes is not a "supported feature" ATM.

          If you were to precompile the classes, making sure the versions in both JVMs are binary compatible, you could probably serialize the classes across. However, with the current weaving you need to access the AspectManager, which contains all the advice bindings etc. and this is configured and initialized local to the jvm, so you would need a jboss-aop.xml on the client.

          I am working on reweaving of AOP for AOP 2.0, and have run into some issues there regarding serialization, but need to talk to Bill about that when he's back from holiday.

          • 2. Re: Advised classes after serialization
            Tim Fox Master

            Thanks Kab.

            So it seems serialization of advised classes is probably not the right choice for us for now.

            Another thought would be to load the aop config from the server at client startup and then use that to initialise the aop engine on the client. That would prevent us having to maintain a jboss-aop.xml on the client.

            Is it possible to programmatically start aop explicitly with a supplied config., rather than one having to be available in the META-INF directory or on the file system?

            Or perhaps this is a dumb idea?


            • 3. Re: Advised classes after serialization
              Kabir Khan Master

              Whether or not it will work in this case I can't guarantee, but we do support dynamically adding/removing aop.xml files at runtime. The entry point would be


              Let me know how you get on