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

MessageBatch: removal on iteration is inefficient

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 5.0.0.Alpha3, 4.2.0
    • None
    • None

      We oftentimes have iteration through a MessageBatch and removal, e.g.

      for(Message msg: batch) {
          if(condition)
              batch.remove(msg);
         }
      }
      

      This is inefficient for large batches, as MessageBatch.remove() iterates through the batch until it finds the message to be nulled.

      It is more efficient to use BatchIterator.remove().

      Also include a BatchIterator.replace() method.

      Pedro's code: [1] https://github.com/pruivo/JGroups/tree/t_msg_batch_iterator

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

                Created:
                Updated:
                Resolved: