Source:
<code>public void deliverMessagesSingleThreaded() { if (!backendContext.areUpdatesDelayed()) { final Set<CommunicationGroup> seenInThisCycle = new LinkedHashSet<CommunicationGroup>(); CommunicationGroup lastGroup = null; while (!tracker.isEmpty()) { final CommunicationGroup group = tracker.getAndRemoveFirstGroup(); final Node representative = group.getRepresentative(); <START> boolean okGroup = !seenInThisCycle.contains(group) || (lastGroup != null && lastGroup.getIdentifier() == group.getIdentifier()); <END> if (!okGroup) { logger.error( "[INTERNAL ERROR] Violation of communication schema! The communication component with representative " + representative + " has already been processed!"); } seenInThisCycle.add(group); while (!group.getNonMonotoneMailboxes().isEmpty() || !group.getDefaultMailboxes().isEmpty()) { while (!group.getNonMonotoneMailboxes().isEmpty()) { Mailbox mailbox = group.getNonMonotoneMailboxes().iterator().next(); group.getNonMonotoneMailboxes().remove(mailbox); mailbox.deliverAll(MessageKind.ANTI_MONOTONE); } while (!group.getDefaultMailboxes().isEmpty()) { Mailbox mailbox = group.getDefaultMailboxes().iterator().next(); group.getDefaultMailboxes().remove(mailbox); mailbox.deliverAll(null); } } while (!group.getRederivables().isEmpty()) { RederivableNode node = group.getRederivables().iterator().next(); node.rederiveOne(); } while (!group.getMonotoneMailboxes().isEmpty() || !group.getDefaultMailboxes().isEmpty()) { while (!group.getMonotoneMailboxes().isEmpty()) { Mailbox mailbox = group.getMonotoneMailboxes().iterator().next(); group.getMonotoneMailboxes().remove(mailbox); mailbox.deliverAll(MessageKind.MONOTONE); } while (!group.getDefaultMailboxes().isEmpty()) { Mailbox mailbox = group.getDefaultMailboxes().iterator().next(); group.getDefaultMailboxes().remove(mailbox); mailbox.deliverAll(null); } } lastGroup = group; } } }</code><technical_language>replace boolean okGroup = (group == lastGroup) || !seenInThisCycle.contains(group) ? I is a point in comparing identifiers, this faster, seen... collection is consulted often</technical_language>

Target:
public void deliverMessagesSingleThreaded() { if (!backendContext.areUpdatesDelayed()) { final Set<CommunicationGroup> seenInThisCycle = new LinkedHashSet<CommunicationGroup>(); CommunicationGroup lastGroup = null; while (!tracker.isEmpty()) { final CommunicationGroup group = tracker.getAndRemoveFirstGroup(); final Node representative = group.getRepresentative(); boolean okGroup = (group == lastGroup) || !seenInThisCycle.contains(group); if (!okGroup) { logger.error( "[INTERNAL ERROR] Violation of communication schema! The communication component with representative " + representative + " has already been processed!"); } seenInThisCycle.add(group); while (!group.getNonMonotoneMailboxes().isEmpty() || !group.getDefaultMailboxes().isEmpty()) { while (!group.getNonMonotoneMailboxes().isEmpty()) { Mailbox mailbox = group.getNonMonotoneMailboxes().iterator().next(); group.getNonMonotoneMailboxes().remove(mailbox); mailbox.deliverAll(MessageKind.ANTI_MONOTONE); } while (!group.getDefaultMailboxes().isEmpty()) { Mailbox mailbox = group.getDefaultMailboxes().iterator().next(); group.getDefaultMailboxes().remove(mailbox); mailbox.deliverAll(null); } } while (!group.getRederivables().isEmpty()) { RederivableNode node = group.getRederivables().iterator().next(); node.rederiveOne(); } while (!group.getMonotoneMailboxes().isEmpty() || !group.getDefaultMailboxes().isEmpty()) { while (!group.getMonotoneMailboxes().isEmpty()) { Mailbox mailbox = group.getMonotoneMailboxes().iterator().next(); group.getMonotoneMailboxes().remove(mailbox); mailbox.deliverAll(MessageKind.MONOTONE); } while (!group.getDefaultMailboxes().isEmpty()) { Mailbox mailbox = group.getDefaultMailboxes().iterator().next(); group.getDefaultMailboxes().remove(mailbox); mailbox.deliverAll(null); } } lastGroup = group; } } }