SubscriptionList.SubscriptionNodeIterator subscriptionIter = _subscriptionList.iterator();
//iterate over the subscribers and try to advance their pointer
while (subscriptionIter.advance())
{
Subscription sub = subscriptionIter.getNode().getSubscription();
sub.getSendLock();
try
{
for(int i = 0 ; i < perSub; i++)
{
//attempt delivery. returns true if no further delivery currently possible to this sub
subscriptionDone = attemptDelivery(sub, true);
if (subscriptionDone)
{
sub.flushBatched();
if (lastLoop && !sub.isSuspended())
{
sub.queueEmpty();
}
break;
}
else
{
//this subscription can accept additional deliveries, so we must
//keep going after this (if iteration slicing allows it)
allSubscriptionsDone = false;
lastLoop = false;
if(--iterations == 0)
{
sub.flushBatched();
break;
}
}
}
sub.flushBatched();
}
finally
{
sub.releaseSendLock();
}
}
if(allSubscriptionsDone && lastLoop)
{