Package org.jboss.messaging.core.contract

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


   {
      static MessageOrderComparator instance = new MessageOrderComparator();

      public int compare(Object o1, Object o2)
      {
         MessageReference ref1;
         MessageReference ref2;

         if (o1 instanceof MessageReference)
         {
            ref1 = (MessageReference) o1;
            ref2 = (MessageReference) o2;
         }
         else
         {
            ref1 = ((ChannelRefPair) o1).ref;
            ref2 = ((ChannelRefPair) o2).ref;
         }

         long id1 = ref1.getMessage().getMessageID();
         long id2 = ref2.getMessage().getMessageID();

         return (id1 < id2 ? -1 : (id1 == id2 ? 0 : 1));
      }
View Full Code Here


   {
      if (trace) { log.trace(this + " routing from cluster " + message + ", routing key " + routingKeyText + ", queue names " + queueNames); }

      Condition routingKey = conditionFactory.createCondition(routingKeyText);

      MessageReference ref = message.createReference();
        
      routeInternal(ref, routingKey, null, true, queueNames);       
   }
View Full Code Here

          
           Iterator iter = messageRefs.iterator();
          
           while (iter.hasNext())
           {
             MessageReference ref = (MessageReference)iter.next();
            
             Message message = ref.getMessage();
            
             String sessionID = (String)toRecover.remove(new Long(message.getMessageID()));
            
             if (sessionID != null)
             {
               if (trace) { log.trace("Added ref " + ref + " to recovery map"); }
              
               RecoveryEntry re = new RecoveryEntry();
               re.ref = ref;
               re.sessionID = sessionID;
              
               recoveryMap.put(new Long(message.getMessageID()), re);
              
               deliveringCount.increment(ref.getMessage());
              
               iter.remove();
              
               toTimeout.addLast(ref);
             }
View Full Code Here

               log.trace("Session id id " + re.sessionID);
            }

            if (re.sessionID.equals(sessionID))
            {
               MessageReference ref = re.ref;

               iter.remove();

               // Put back on queue

               toCancel.add(ref);
            }
         }
      }
    
     for (int i = toCancel.size() - 1; i >= 0; i--)
     {
       MessageReference ref = (MessageReference)toCancel.get(i);
      
       synchronized (lock)
      {
        messageRefs.addFirst(ref, ref.getMessage().getPriority());
       
        //Need to decrement the delivery count too
        deliveringCount.decrement(ref.getMessage());
      }
             
      if (trace) { log.trace("Found one, added back on queue"); }  
     }
    
View Full Code Here

     
      boolean added = false;
         
      while (iter.hasNext())
      {
        MessageReference ref = (MessageReference)iter.next();
       
        Object obj = recoveryMap.remove(new Long(ref.getMessage().getMessageID()));
       
        if (obj != null)
        {
          if (trace) { log.trace("Adding ref " + ref + " back into queue"); }
           
          synchronized (lock)
          {   
            messageRefs.addFirst(ref, ref.getMessage().getPriority());   
           
            deliveringCount.decrement(ref.getMessage());
          }         
         
          added = true;
        }
      }
View Full Code Here

               }

               while (iter.hasNext())
               {
                  // We may need to persist the message itself
                  MessageReference ref = (MessageReference) iter.next();

                  // For non reliable refs we insert the ref (and maybe the
                  // message) itself

                  // Now store the reference
                   
                  log.trace("Paged ref with page order " + ref.getPagingOrder());

                  addReference(channelID, ref, psInsertReference, page);

                  int rows = psInsertReference.executeUpdate();

                  if (trace)
                  {
                     log.trace("Inserted " + rows + " rows");
                  }
                 
                  // Maybe we need to persist the message itself
                  Message m = ref.getMessage();

                  rows = storeMessage(m, psInsertMessage, psUpdateMessage);

                  if (trace)
                  {
View Full Code Here

               Iterator iter = references.iterator();

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

                  removeReference(channelID, ref, psDeleteReference);

                  int rows = psDeleteReference.executeUpdate();
View Full Code Here

               psUpdateReference = conn
                     .prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));

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

                  psUpdateReference.setLong(1, ref.getPagingOrder());

                  psUpdateReference.setLong(2, ref.getMessage().getMessageID());

                  psUpdateReference.setLong(3, channelID);

                  int rows = psUpdateReference.executeUpdate();
View Full Code Here

               boolean first = true;

               for (Iterator i = refsToAdd.iterator(); i.hasNext();)
               {
                  ChannelRefPair pair = (ChannelRefPair) i.next();
                  MessageReference ref = pair.ref;

                  if (psReference == null)
                  {
                     psReference = conn
                           .prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
                  }

                  // Now store the reference
                  addReference(pair.channelID, ref, psReference, false);

                  int rows = psReference.executeUpdate();

                  if (trace)
                  {
                     log.trace("Inserted " + rows + " rows");
                  }

                  Message m = ref.getMessage();

                  synchronized (m)
                  {
                     if (!m.isPersisted())
                     {
View Full Code Here

               while (iter.hasNext())
               {
                  Object obj = iter.next();

                  MessageReference ref;
                  if (obj instanceof MessageReference)
                  {
                     ref = (MessageReference) obj;
                  }
                  else
                  {
                     ref = ((ChannelRefPair) obj).ref;
                  }

                  psMessage.setLong(1, ref.getMessage().getMessageID());
                  psMessage.setLong(2, ref.getMessage().getMessageID());

                  int rows = psMessage.executeUpdate();

                  if (trace)
                  {
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.