catch (Throwable t) { throw new JBossJMSException("Failed to cancel message", t); } if (!cancelled) { throw new IllegalStateException("Cannot find delivery to cancel"); } else { promptDelivery(); }
   public void cancelMessage(Serializable messageID) throws JMSException   {            try      {                  acquireLock();         boolean cancelled = false;         Iterator iter = deliveries.iterator();         try         {                     while (iter.hasNext())            {               SingleReceiverDelivery del = (SingleReceiverDelivery)iter.next();               if (del.getReference().getMessageID().equals(messageID))               {                  if (del.cancel())                  {                     cancelled = true;                     iter.remove();                     break;                  }                  else                  {                     throw new JMSException("Failed to cancel delivery: " + messageID);                  }               }            }         }         catch (Throwable t)         {            throw new JBossJMSException("Failed to cancel message", t);         }         if (!cancelled)         {            throw new IllegalStateException("Cannot find delivery to cancel");         }         else         {                     promptDelivery();         }      }      finally      {         releaseLock();      }   }