[jboss-cvs] JBossAS SVN: r68631 - in branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq: server and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 4 14:02:53 EST 2008


Author: miclark
Date: 2008-01-04 14:02:53 -0500 (Fri, 04 Jan 2008)
New Revision: 68631

Modified:
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java
Log:
[JBAS-4945] - Migrating Adrian\'s bugfix to the CP Branch

Modified: branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java	2008-01-04 15:49:50 UTC (rev 68630)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java	2008-01-04 19:02:53 UTC (rev 68631)
@@ -51,6 +51,9 @@
    /** Whether trace is enabled */
    static boolean trace = log.isTraceEnabled();
    
+   /** Delivered once */
+   static final Integer ONCE = new Integer(1);
+   
    // Attributes ----------------------------------------------------
 
    /** The connection is the consumer was created with */
@@ -153,6 +156,7 @@
          
          if (waitingForMessage)
          {
+            prepareDelivery(mes);
             queue.addLast(mes);
             queue.notifyAll();
          }
@@ -164,7 +168,27 @@
          }
       }
    }
-   
+
+   /**
+    * Prepare the message for delivery
+    *
+    * @param message the message
+    * @throws JMSException for any error
+    */
+   void prepareDelivery(SpyMessage message) throws JMSException
+   {
+      Integer delivery = ONCE;
+      Integer redelivery = (Integer) message.header.jmsProperties.get(SpyMessage.PROPERTY_REDELIVERY_COUNT);
+      if (redelivery != null)
+      {
+         int value = redelivery.intValue();
+         if (value != 0)
+            delivery = new Integer(value + 1);
+      }
+      message.header.jmsProperties.put(SpyMessage.PROPERTY_DELIVERY_COUNT, delivery);
+   }
+    
+    
    // ConnectionConsumer implementation -----------------------------
 
    public ServerSessionPool getServerSessionPool() throws JMSException

Modified: branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java	2008-01-04 15:49:50 UTC (rev 68630)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/main/org/jboss/mq/server/JMSDestinationManager.java	2008-01-04 19:02:53 UTC (rev 68631)
@@ -409,7 +409,8 @@
       // Reset any redelivered information
       val.setJMSRedelivered(false);
       val.header.jmsProperties.remove(SpyMessage.PROPERTY_REDELIVERY_COUNT);
-
+      val.header.jmsProperties.remove(SpyMessage.PROPERTY_DELIVERY_COUNT);
+      
       //Add the message to the queue
       val.setReadOnlyMode();
       queue.addMessage(val, txId);




More information about the jboss-cvs-commits mailing list