Routable r = (Routable)i.next(); if (filter == null || filter.accept(r))
MessageReference r = (MessageReference)i.next(); if (filter == null || filter.accept(r.getMessage()))
   public List undelivered(Filter filter)   {      if (log.isTraceEnabled())      {         log.trace("Getting undelivered unreliable messages");      }      List undelivered = new ArrayList();      synchronized(messageRefs)      {         for(Iterator i = messageRefs.iterator(); i.hasNext(); )         {            Routable r = (Routable)i.next();            if (filter == null || filter.accept(r))            {               if (log.isTraceEnabled()) { log.trace("Accepted by filter so adding to list"); }               undelivered.add(r);            }            else            {               if (log.isTraceEnabled()) { log.trace("NOT Accepted by filter so not adding to list"); }            }         }      }      if (log.isTraceEnabled())      {         log.trace("I have " + undelivered.size() + " undelivered messages");      }      return undelivered;   }