Package org.jboss.messaging.core.message

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


         {
            // if paging and the in memory queue is exactly full we need to evict the end reference to storage to
            // preserve the number of refs in the queue
            if (messageRefs.size() == fullSize + 1)
            {
               MessageReference refCancel = (MessageReference)messageRefs.removeLast();
   
               addToDownCache(refCancel, true);
            }
         }
              
View Full Code Here


      }
   }
     
   protected MessageReference removeFirstInMemory() throws Exception
   {
      MessageReference result = super.removeFirstInMemory();

      checkLoad();

      return result;
   }
View Full Code Here

      Iterator iter = downCache.iterator();
     
      while (iter.hasNext())
      {
         MessageReference ref = (MessageReference) iter.next();
          
         if (ref.getMessage().isReliable() && recoverable)
         {
            toUpdate.add(ref);
         }
         else
         {
            toAdd.add(ref);
         }
      }
     
      if (!toAdd.isEmpty())
      {
         pm.pageReferences(channelID, toAdd, true);
      }
      if (!toUpdate.isEmpty())
      {
         pm.updatePageOrder(channelID, toUpdate);
      }

      // Release in memory refs for the refs we just spilled
      // Note! This must be done after the db inserts - to ensure message is
      // still in memory
      iter = downCache.iterator();

      while (iter.hasNext())
      {
         MessageReference ref = (MessageReference) iter.next();

         ref.releaseMemoryReference();
      }

      downCache.clear();        

      if (trace) { log.trace(this + " cleared downcache"); }
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))
      {
         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(new Long(msgId), ref);
         }
         else
         {
            // Add id to list of msg ids to load
            msgIdsToLoad.add(new Long(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();

            // Message might actually be know to the store since we did the
            // first check since might have been added by different channel
            // in intervening period, but this is ok - the store knows to only
            // return a reference to the pre-existing message
            MessageReference ref = ms.reference(m);
           
            refMap.put(new Long(m.getMessageID()), ref);
         }
      }
     
View Full Code Here

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            Message msg = CoreMessageFactory.createCoreMessage(i, true, null);

            MessageReference ref = ms.reference(msg);

            office1.route(ref, new SimpleCondition("topic1"), tx);
         }

         Thread.sleep(1000);
View Full Code Here

         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            Message msg = CoreMessageFactory.createCoreMessage(i, true, null);

            MessageReference ref = ms.reference(msg);

            office1.route(ref, new SimpleCondition("topic1"), tx);
         }

         Thread.sleep(1000);
View Full Code Here

                                    true, true, -1, null, tr);
         office2.bindClusteredQueue(new SimpleCondition("queue1"), queue2);

         Message msg = CoreMessageFactory.createCoreMessage(1, true, null);

         MessageReference ref = ms.reference(msg);

         office1.route(ref, new SimpleCondition("queue1"), null);

         Thread.sleep(2000);
View Full Code Here

                                    true, true, -1, null, tr);
         office2.bindClusteredQueue(new SimpleCondition("queue1"), queue2);

         Message msg = CoreMessageFactory.createCoreMessage(1, true, null);

         MessageReference ref = ms.reference(msg);

         office1.route(ref, new SimpleCondition("queue1"), null);

         Thread.sleep(2000);
View Full Code Here

                                    true, true, -1, null, tr);
         office2.bindClusteredQueue(new SimpleCondition("queue1"), queue2);

         Message msg = CoreMessageFactory.createCoreMessage(1, true, null);

         MessageReference ref = ms.reference(msg);

         office1.route(ref, new SimpleCondition("queue1"), null);

         Thread.sleep(2000);
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.message.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.