2 Replies Latest reply on Nov 2, 2007 5:07 PM by Tim Fox

    JBMESSAGING-1138 - Using Object lists on messages

    Clebert Suconic Master

      If you look at StreamUtils we are converting any List (or any Map) to ArrayList and HashMap.

      that means if an user is using any special list (such as Vector, or any other custom lists) we are converting them to those maps.


      Because of this, I'm changing MessageSupport::getPayloadAsByteArray to call Streamutils.writeObject with containerTypes=false.

      Object*Stream is more optimized to those types anyway. And besides if you have graph dependencies on those objects, at this point we are just writing several independent objects. Say if you recover objects from Hibernate and send those over JMS they will all be flat objects after receiving.

        • 1. Re: JBMESSAGING-1138 - Using Object lists on messages
          Tim Fox Master

           

          "clebert.suconic@jboss.com" wrote:
          If you look at StreamUtils we are converting any List (or any Map) to ArrayList and HashMap.

          that means if an user is using any special list (such as Vector, or any other custom lists) we are converting them to those maps.


          Because of this, I'm changing MessageSupport::getPayloadAsByteArray to call Streamutils.writeObject with containerTypes=false.


          I don't think that's a good fix.If you do that it's going to use Java serialization for other message types too.

          We *only* want to use Java serialization for Object messages, not for other messages like map messages.

          A better fix is to override getPayloadAsByteArray on the Objectmessage.

          • 2. Re: JBMESSAGING-1138 - Using Object lists on messages
            Tim Fox Master

            Better still create a method on MessageSupport doWrite(), that by default does:
            StreamUtils.writeObject(daos, payload, true, true);
            then override it on Object Message to do
            StreamUtils.writeObject(daos, payload, false, true);
            then you won't end up duplicating the getPayloadAsByteArray() logic