Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1773

TP$MyHandler.handleSingleMessage() makes an unnecessary copy of the buffer

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 3.5
    • None
    • None

      When a single message is received, we pass it to the thread pool for parsing, passing a copy of the byte array to the MyHandler runnable.
      The parsing then creates a new Message and calls readFrom(). This method reads the headers and then creates a payload buffer of the size read from the input stream, then copies size bytes from the input stream to the mesage's payload.
      This is an unneeded copy; as we already have a copy of the byte array, we only need to reference the byte array from the message and set the offset and length, saving us one copy of the buffer.

            rhn-engineering-bban Bela Ban
            rhn-engineering-bban Bela Ban
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: