Examples of MessageReference


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

   {
      static MessageOrderComparator instance = new MessageOrderComparator();
     
      public int compare(Object o1, Object o2)
      {       
         MessageReference ref1 = (MessageReference)o1;
         MessageReference ref2 = (MessageReference)o2;

         long id1 = ref1.getMessage().getMessageID();        
         long id2 = ref2.getMessage().getMessageID();
        
         return (id1 < id2 ? -1 : (id1 == id2 ? 0 : 1));
      }     
View Full Code Here

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

         }
        
         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
                          
            if (!usingBatchUpdates)
            {
               psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
            }
           
            //Now store the reference
            addReference(channelID, ref, psInsertReference, paged);
                       
            if (usingBatchUpdates)
            {
               psInsertReference.addBatch();
            }
            else
            {
               int rows = updateWithRetry(psInsertReference);
              
               if (trace)
               {
                  log.trace("Inserted " + rows + " rows");
               }
              
               psInsertReference.close();
               psInsertReference = null;
            }
           
            if (!usingBatchUpdates)
            {
               psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
               psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
            }
                                                                                    
            //Maybe we need to persist the message itself
            Message m = ref.getMessage();
           
            //In a paging situation, we cannot use the persisted flag on the message to determine whether
            //to insert the message or not.
            //This is because a channel (possibly on another node) may be paging too and referencing
            //the same message, and might have removed the message independently, the other
View Full Code Here

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

            psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
         }
        
         while (iter.hasNext())
         {
            MessageReference ref = (MessageReference) iter.next();
                                                            
            if (!usingBatchUpdates)
            {
               psDeleteReference = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE_REF"));
            }
           
            removeReference(channelID, ref, psDeleteReference);
           
            if (usingBatchUpdates)
            {
               psDeleteReference.addBatch();
            }
            else
            {
               int rows = updateWithRetry(psDeleteReference);
              
               if (trace) { log.trace("Deleted " + rows + " rows"); }
              
               psDeleteReference.close();
               psDeleteReference = null;
            }
           
            if (!usingBatchUpdates)
            {
               psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
               psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
            }
              
            Message m = ref.getMessage();
                                   
            //Maybe we need to delete the message itself
             
            //Update the message with the new channel count
            decrementChannelCount(m, psUpdateMessage);
View Full Code Here

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

            psUpdateReference = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
         }
        
         while (iter.hasNext())
         {
            MessageReference ref = (MessageReference) iter.next();
                
            if (!usingBatchUpdates)
            {
               psUpdateReference = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
            }
           
            psUpdateReference.setLong(1, ref.getPagingOrder());

            psUpdateReference.setLong(2, ref.getMessage().getMessageID());
           
            psUpdateReference.setLong(3, channelID);
           
            if (usingBatchUpdates)
            {
View Full Code Here

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

         }

         for(Iterator i = refsToAdd.iterator(); i.hasNext(); )
         {
            ChannelRefPair pair = (ChannelRefPair)i.next();
            MessageReference ref = pair.ref;
                                               
            if (!batch)
            {
               psReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
            }
           
            // Now store the reference
            addReference(pair.channelID, ref, psReference, false);
             
            if (batch)
            {
               psReference.addBatch();
            }
            else
            {
               int rows = updateWithRetry(psReference);
              
               if (trace) { log.trace("Inserted " + rows + " rows"); }                             
              
               psReference.close();
               psReference = null;
            }
           
            Message m = ref.getMessage();       
           
            if (!batch)
            {
               psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
               psIncMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
View Full Code Here

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

         iter = refsToRemove.iterator();
         while (iter.hasNext())
         {
            ChannelRefPair pair = (ChannelRefPair) iter.next();
           
            MessageReference ref = pair.ref;
           
            if (!batch)
            {
               psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
               psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
            }
           
            Message m = ref.getMessage();
                                  
            //We may need to remove the message itself
           
            //Update the channel count
           
View Full Code Here

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

   protected void getLocks(List refs)
   {
      Iterator iter = refs.iterator();
      while (iter.hasNext())
      {
         MessageReference ref = (MessageReference)iter.next();
         Message m = ref.getMessage();
         LockMap.instance.obtainLock(m);       
      }
   }
View Full Code Here

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

   protected void releaseLocks(List refs)
   {
      Iterator iter = refs.iterator();
      while (iter.hasNext())
      {
         MessageReference ref = (MessageReference)iter.next();
         Message m = ref.getMessage();
         LockMap.instance.releaseLock(m);        
      }
   }
View Full Code Here

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

        
         Message msg = pair.getMessage();
        
         long channelID = pair.getChannelId();
        
         MessageReference ref = null;
        
         try
         {
            ref = messageStore.reference(msg);        

            //Need to get the post office reference lazily, cannot pass into constructor
            Binding binding = postOffice.getBindingforChannelId(channelID);
           
            if (binding == null)
            {
               throw new IllegalStateException("Cannot find binding for channel id " + channelID);
            }
           
            Queue queue = binding.getQueue();
                       
            if (trace) log.trace("Destination for message[ID=" + ref.getMessage().getMessageID() + "] is: " + queue);
  
            queue.handle(null, ref, tx);
         }
         finally
         {
            if (ref != null)
            {
               //Need to release reference
               ref.releaseMemoryReference();
            }
         }
      }
   }
View Full Code Here

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

        
         Message msg = pair.getMessage();
        
         long channelID = pair.getChannelId();
        
         MessageReference ref = null;
        
         try
         {
            ref = messageStore.reference(msg);        

            // Need to get the post office reference lazily, cannot pass into constructor
            Binding binding = postOffice.getBindingforChannelId(channelID);
           
            if (binding == null)
            {
               throw new IllegalStateException("Cannot find binding for channel id " + channelID);
            }
           
            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);
            }
           
            dels.add(del);           
         }
         finally
         {
            if (ref != null)
            {
               //Need to release reference
               ref.releaseMemoryReference();
            }
         }
      }
     
      if (!dels.isEmpty())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.