[jboss-jira] [JBoss JIRA] (JGRP-2445) MessageBatch: removal on iteration is inefficient
Bela Ban (Jira)
issues at jboss.org
Tue Feb 4 09:30:50 EST 2020
[ https://issues.redhat.com/browse/JGRP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bela Ban resolved JGRP-2445.
----------------------------
Resolution: Done
Fixed on master and backported to 4.x
> 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
> Priority: Major
> 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()}}.
> Also include a {{BatchIterator.replace()}} method.
> Pedro's code: [1] https://github.com/pruivo/JGroups/tree/t_msg_batch_iterator
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list