Package org.jboss.messaging.core.contract

Examples of org.jboss.messaging.core.contract.MessageReference


      Iterator iter = downCache.iterator();
     
      while (iter.hasNext())
      {
         MessageReference ref = (MessageReference) iter.next();
        
         if (ref.getMessage().isReliable() && recoverable)
         {
            toUpdate.add(ref);
         }
         else
         {
View Full Code Here


      Iterator iter = ili.getRefInfos().iterator();
      while (iter.hasNext())
      {
         ReferenceInfo info = (ReferenceInfo)iter.next();
        
         MessageReference added = addFromRefInfo(info, refMap);
      }
   }
View Full Code Here

  
   protected MessageReference addFromRefInfo(ReferenceInfo info, Map refMap)
   {
      long msgId = info.getMessageId();

      MessageReference ref = (MessageReference)refMap.get(new Long(msgId));

      ref.setDeliveryCount(info.getDeliveryCount());

      ref.setPagingOrder(-1);
     
      ref.setScheduledDeliveryTime(info.getScheduledDelivery());
        
      //Schedule the delivery if necessary, or just add to the in memory queue
      if (!checkAndSchedule(ref))
      {
         monitor.registerMessage(ref);
         messageRefs.addLast(ref, ref.getMessage().getPriority());
      }
     
      return ref;
   }
View Full Code Here

      {
         ReferenceInfo info = (ReferenceInfo) iter.next();

         long msgId = info.getMessageId();

         MessageReference ref = ms.reference(msgId);

         if (ref != null)
         {
            refMap.put(msgId, ref);
         }
         else
         {
            // Add id to list of msg ids to load
            msgIdsToLoad.add(msgId);
         }
      }

      // Load the messages (if any)
      List messages = null;
      if (!msgIdsToLoad.isEmpty())
      {
         messages = pm.getMessages(msgIdsToLoad);

         if (messages.size() != msgIdsToLoad.size())
         {
            // Sanity check          
           
            throw new IllegalStateException("Did not load correct number of messages, wanted:" +
                                            msgIdsToLoad.size() + " but got:" +
                                            messages.size());           
         }

         // Create references for these messages and add them to the reference map
         iter = messages.iterator();

         while (iter.hasNext())
         {
            Message m = (Message)iter.next();
           
            MessageReference ref = ms.reference(m);

            refMap.put(new Long(m.getMessageID()), ref);
         }
      }
     
View Full Code Here

   private void moveInTransaction(JBossMessage msg, Delivery del, Queue queue, boolean dlq) throws Throwable
   {
      Transaction tx = tr.createTransaction();

      MessageReference ref = msg.createReference();

      try
      {
         if (queue != null)
         {
View Full Code Here

         Message msg = pair.getMessage();

         long channelID = pair.getChannelId();

         MessageReference ref = messageStore.reference(msg);

         ref.getMessage().setPersisted(true);

         Binding binding = postOffice.getBindingForChannelID(channelID);

         if (binding == null)
         {
            throw new IllegalStateException("Cannot find binding for channel id " + channelID);
         }

         Queue queue = binding.queue;

         if (trace) log.trace("Destination for message[ID=" + ref.getMessage().getMessageID() + "] is: " + queue);

         // The actual jmx queue may not have been deployed yet, so we need to activate the core queue if so,
         // or the handle will have no effect

         boolean deactivate = false;
View Full Code Here

         Message msg = pair.getMessage();

         long channelID = pair.getChannelId();

         MessageReference ref = null;

         ref = messageStore.reference(msg);

         ref.getMessage().setPersisted(true);

         Binding binding = postOffice.getBindingForChannelID(channelID);

         if (binding == null)
         {
            throw new IllegalStateException("Cannot find binding for channel id " + channelID);
         }

         Queue queue = binding.queue;

         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, true, true);

         if (trace) log.trace("Acknowledging..");
View Full Code Here

    */
   public void cancel(Delivery del) throws Throwable
   {
      //We may need to update the delivery count in the database

      MessageReference ref = del.getReference();

      if (ref.getMessage().isReliable())
      {
         pm.updateDeliveryCount(this.channelID, ref);
      }

      if (!del.isRecovered())
View Full Code Here

         // dereference pass
         ArrayList messages = new ArrayList(references.size());
         for (Iterator i = references.iterator(); i.hasNext();)
         {
            MessageReference ref = (MessageReference) i.next();
            messages.add(ref.getMessage());
         }
         return messages;
      }
   }
View Full Code Here

         //also we might get race conditions when other channels are updating the same message in the db

         //Note - we don't do this in a tx - because the tx could be too big if we have millions of refs
         //paged in storage

         MessageReference ref;
         while ((ref = removeFirstInMemory()) != null)
         {
           log.trace("Removing ref " + ref);

            SimpleDelivery del = new SimpleDelivery(this, ref);
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.contract.MessageReference

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.