[jboss-jira] [JBoss JIRA] (JGRP-2445) MessageBatch: removal on iteration is inefficient

Bela Ban (Jira) issues at jboss.org
Tue Feb 4 06:11:59 EST 2020


Bela Ban created JGRP-2445:
------------------------------

             Summary: MessageBatch: removal on iteration is inefficient
                 Key: JGRP-2445
                 URL: https://issues.redhat.com/browse/JGRP-2445
             Project: JGroups
          Issue Type: Enhancement
            Reporter: Bela Ban
            Assignee: Bela Ban
             Fix For: 5.0, 4.2.0


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

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

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()}}.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list