Package org.jboss.messaging.core

Examples of org.jboss.messaging.core.Delivery


      if (!queues.isEmpty())
      {
         ClusteredQueue queue = (ClusteredQueue)queues.get(target);

         Delivery del = queue.handle(observer, ref, tx);

         if (trace) { log.trace(this + " routed to remote queue, it returned " + del); }

         incTarget();
View Full Code Here


                  throw new IllegalStateException("Local post office has foreign bindings!");
               }

               Queue queue = binding.getQueue();

               Delivery del = queue.handle(null, ref, tx);

               if (del != null && del.isSelectorAccepted())
               {
                  routed = true;
               }
            }
View Full Code Here

   public void acknowledge(Message r, Transaction tx) throws Throwable
   {
      log.debug(this + " acknowledging "  + r);

      Object[] touple = null;
      Delivery d = null;
      for (Iterator i = messages.iterator(); i.hasNext(); )
      {
         Object[] o = (Object[])i.next();
         Message m = (Message)o[0];
         if (m == r)
         {
            log.trace("*** found it");
            d = (Delivery)o[1];
            touple = o;
            break;
         }
      }

      if (touple == null)
      {
         throw new IllegalStateException("The message " + r + " hasn't been received yet!");
      }

      if (d == null)
      {
         throw new IllegalStateException("The message " + r + " has already been acknowledged!");
      }

      d.acknowledge(tx);

      log.trace(this + " acknowledged "  + r);

      // make sure I get rid of message if the transaction is rolled back
      if (tx != null)
View Full Code Here

   }

   public void cancel(Message r) throws Throwable
   {
      Object[] touple = null;
      Delivery d = null;
      for (Iterator i = messages.iterator(); i.hasNext(); )
      {
         Object[] o = (Object[])i.next();
         Message m = (Message)o[0];
         if (m == r)
         {
            d = (Delivery)o[1];
            touple = o;
            i.remove();
            break;
         }
      }

      if (touple == null)
      {
         throw new IllegalStateException("The message " + r + " hasn't been received yet!");
      }

      if (d == null)
      {
         throw new IllegalStateException("The message " + r + " has already been acknowledged!");
      }

      d.cancel();

      log.trace(this + " cancelled "  + r);
   }
View Full Code Here

            Queue queue = binding.getQueue();
  
            if (trace) log.trace("Destination for message[ID=" + ref.getMessage().getMessageID() + "] is: " + queue);
  
            //Create a new delivery - note that it must have a delivery observer otherwise acknowledge will fail
            Delivery del = new SimpleDelivery(queue, ref);

            if (trace) log.trace("Acknowledging..");

            try
            {
               del.acknowledge(tx);
            }
            catch (Throwable t)
            {
               log.error("Failed to acknowledge " + del + " during recovery", t);
            }
View Full Code Here

        
         //Need to cancel in reverse
        
         for (int i = toCancel.size() - 1; i >= 0; i--)
         {                    
            Delivery del = (Delivery)toCancel.get(i);
           
            try
            {
               del.cancel();
            }
            catch (Throwable t)
            {
               log.error("Failed to cancel delivery", t);
               throw new TransactionException(t.getMessage(), t);
View Full Code Here

      if (receiversCopy.isEmpty())
      {
         return null;
      }

      Delivery del = null;
     
      boolean selectorRejected = false;
     
      int initial = target;

      while (true)
      {
         Receiver r = (Receiver)receiversCopy.get(target);

         try
         {
            Delivery d = r.handle(observer, ref, tx);

            if (trace) { log.trace("receiver " + r + " handled " + ref + " and returned " + d); }

            if (d != null)
            {
               if (d.isSelectorAccepted())
               {
                  // deliver to the first receiver that accepts
                  del = d;
                 
                  incTarget();
View Full Code Here

           
            makeCopy = false;
         }
      }   
     
      Delivery del = null;
     
      boolean selectorRejected = false;

      for(Iterator i = receiversCopy.iterator(); i.hasNext(); )
      {
         Receiver receiver = (Receiver)i.next();

         try
         {
            Delivery d = receiver.handle(observer, ref, tx);

            if (trace) { log.trace("receiver " + receiver + " handled " + ref + " and returned " + d); }

            if (d != null)
            {
               if (d.isSelectorAccepted())
               {
                  // deliver to the first receiver that accepts
                  del = d;
                  break;
               }
View Full Code Here

     
      Message msg = CoreMessageFactory.createCoreMessage(123, true, null);
     
      MessageReference ref = ms.reference(msg);
           
      Delivery del = router.handle(null, ref, null);
      assertNotNull(del);
      checkReceiverGotRef(receivers, 0);
      resetReceivers(receivers);
     
      del = router.handle(null, ref, null);
View Full Code Here

     
      Message msg = CoreMessageFactory.createCoreMessage(123, true, null);
     
      MessageReference ref = ms.reference(msg);
     
      Delivery del = router.handle(null, ref, null);
      assertNotNull(del);
      checkReceiverGotRef(receivers, 0);
      resetReceivers(receivers);
     
      del = router.handle(null, ref, null);
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.Delivery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.