6 Replies Latest reply on Jan 19, 2007 2:50 PM by glooper

    resolveClass and annotateClass

    glooper

      I am currently looking at JBoss Serialization as a way to improve our performance with regards to serialization. However currently we store information about the classloader by overriding the annotateClass method. And retrieving that information using the resolveClass where we can ensure the correct class loader is used. However I have noticed that the JBoss serialization does not make the calls to annotateClass so we cannot store the information about the class loader. Do you have any ideas how to solve this problem? or will a future version of JBoss serialization make calls to the annotateClass method?

      Cheers
      Ben

        • 1. Re: resolveClass and annotateClass
          clebert.suconic

          I will verify about the annotateClass calls.

          Sorry about the delay answering this... I got messed up with my mail box.. didn't see the notification.

          • 2. Re: resolveClass and annotateClass
            glooper

            Thankyou... I will look forward to your findings.

            Ben

            • 3. Re: resolveClass and annotateClass
              glooper

              I had a few hours today to have a look at this so was examining your code to see how I would solve my problem. Please correct me if I'm wrong!

              I can't see how you could ever call annotateClass as class information is persisted on the stream seperately to the objects. You are using the ClassMetaData class to describe a class, and you persisting that information using the StreamingClass class.

              I'm guessing that to change jboss serialization such that different class loaders can be used for different serialized objects, I would have to include the relevant information within the ClassMetaData... and change StreamingClass such that it can store the classloader information in saveStream and read the class loader information at the beginning of the readStream method. Does this make sense?

              Ben

              • 4. Re: resolveClass and annotateClass
                clebert.suconic

                Would you happen to have an usecase for where annotateClass/annotateProxyClass would be useful?

                A testcase would be even better.


                I will have to change where I'm writing the classNames, probably using some delegation to JBossObjectInputStream/JBossObjectOutputStream. I will have to take a look.

                • 5. Re: resolveClass and annotateClass
                  clebert.suconic

                   

                  I will have


                  I mean... we... case you want to contribute a fix.

                  • 6. Re: resolveClass and annotateClass
                    glooper

                    We write a container and as such have different classloaders throughout the system for the various the applications. To perform HA we sometimes replicate state across many applications... this is done by serializing the object hierarchy... but different objects in this hierarchy can have come from different applications and thus may have different ClassLoaders.
                    We currently annote information about the classloader in the annotateClass and annotateProxyClass methods by writing the classloader information as a String on the stream... thus when resolveClass or resolveProxyClass is called we can read the classloader information from the stream and use it to lookup the relevant class loader to load the class.

                    I hope that makes sense! :)

                    Ben