int numQueuedHeapChangesThisMessage = 0;
int numActionsThisMessage = 0;
List<Update> updatesThisBatch = new ArrayList<Update>();
Iterator<Update> queuedIt = updatesThisCycle.iterator();
while (queuedIt.hasNext()) {
Update u = queuedIt.next();
int actionsThisUpdate = u.getActions().size();
if (numQueuedHeapChangesThisMessage > 0 && numActionsThisMessage + actionsThisUpdate > maxUpdateActionsPerMessage) {
break;
}
updatesThisBatch.add(u);
queuedIt.remove();