Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-3459

AMQPMessage.scanMessageData() creates unecessary buffer wrapper

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.18.0
    • 2.19.0
    • None
    • None

    Description

      The AMQPMessage.scanMessageData(ReadableBuffer) method creates an unecessary buffer wrapper on every decode. The method has the equivalent of:

      decoder.setBuffer(data);
       try {
         //...use decoder..
       } finally {
         decoder.setByteBuffer(null);
       }
      

      Effectively it tries to use the thread-local decoder, then ensure the related buffer is discarded after.

      However the two setter uses are different, with the former taking the ReadableBuffer directly, and the latter method expected to be passed a ByteBuffer, which causes creation of a ReadableBuffer wrapper for it. By passing it null with that method, a needless wrapper object is created. One which is discarded on the next decode by that thread when it sets the next actual buffer. It should be using setBuffer(null).

      Attachments

        Activity

          People

            robbie Robbie Gemmell
            robbie Robbie Gemmell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: