d.cancel();
if (log.isTraceEnabled()) { log.trace("There are " + waiting.size() + " waiting messages to deliver"); }  int n = waiting.size(); for (int i = 0; i < n; i++) {   Message m = (Message)waiting.removeFirst();  if (log.isTraceEnabled()) { log.trace("queueing the message " + m + " for delivery"); } try { threadPool.execute(new DeliveryRunnable(callbackHandler, m, log)); } catch (InterruptedException e) { log.error("Thread interrupted", e); } }
   void setStarted(boolean start)   {           if (start)      {         if (log.isTraceEnabled()) log.trace("attempting to add receiver");         boolean added = destination.add(this);         if (log.isTraceEnabled()) log.trace("added receiver: " + this.id + ", success=" + added);      }      else      {         if (log.isTraceEnabled()) log.trace("attempting to remove receiver from destination: " + destination);         boolean removed = destination.remove(this);         if (log.isTraceEnabled()) log.trace("receiver " + (removed ? "" : "NOT ")  + "removed");         for(Iterator i = deliveries.keySet().iterator(); i.hasNext(); )         {            Object messageID = i.next();            Delivery d = (Delivery)deliveries.get(messageID);            try            {               d.cancel();            }            catch(Throwable t)            {               log.error("Cannot cancel delivery: " + d, t);            }            i.remove();         }      }   }