try
{
while (iter.hasNext())
{
MessageReference ref = iter.next();
if (ref.isPaged() && queueDestroyed)
{
// this means the queue is being removed
// hence paged references are just going away through
// page cleanup
continue;
}
if (filter == null || filter.match(ref.getMessage()))
{
messageAction.actMessage(tx, ref);
iter.remove();
txCount++;
count++;