if (log.isTraceEnabled()){ log.trace(r != null ? r + " requested delivery on " + this : "delivery requested on " + this); }  doDeliver(r);
checkClosed();  if (!checkRef(ref)) { return null; }  Set deliveries = getDeliveries(receiver, ref);  if (deliveries.isEmpty()) {  if (log.isTraceEnabled()){ log.trace(this + ": no deliveries returned for message; there are no receivers"); }  try { state.add(ref);  if (log.isTraceEnabled()){ log.trace("adding reference to state successfully"); } } catch(Throwable t) {  log.error("Cannot handle the message", t); return null; } } else {  try { for (Iterator i = deliveries.iterator(); i.hasNext(); ) { Delivery d = (Delivery)i.next(); if (!d.isDone()) { state.deliver(d); } } } catch(Throwable t) { log.error(this + " cannot manage delivery, passing responsibility to the sender", t);       return new CompositeDelivery(sender, deliveries); } }   return new SimpleDelivery(true);
   public void deliver(Receiver r)   {      if (log.isTraceEnabled()){ log.trace(r != null ? r + " requested delivery on " + this : "delivery requested on " + this); }                    doDeliver(r);        }