[jboss-cvs] JBossAS SVN: r66858 - branches/Branch_4_2/messaging/src/main/org/jboss/mq.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 8 06:36:55 EST 2007


Author: adrian at jboss.org
Date: 2007-11-08 06:36:54 -0500 (Thu, 08 Nov 2007)
New Revision: 66858

Modified:
   branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java
Log:
[JBAS-4945] - Calculate the JMSXDeliveryCount for MDBs as well.

Modified: branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java
===================================================================
--- branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java	2007-11-08 11:26:56 UTC (rev 66857)
+++ branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyConnectionConsumer.java	2007-11-08 11:36:54 UTC (rev 66858)
@@ -50,6 +50,9 @@
 
    /** Whether trace is enabled */
    static boolean trace = log.isTraceEnabled();
+
+   /** Delivered once */
+   static final Integer ONCE = new Integer(1);
    
    // Attributes ----------------------------------------------------
 
@@ -153,6 +156,7 @@
          
          if (waitingForMessage)
          {
+            prepareDelivery(mes);
             queue.addLast(mes);
             queue.notifyAll();
          }
@@ -165,6 +169,25 @@
       }
    }
    
+   /**
+    * 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
@@ -385,4 +408,4 @@
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------
-}
\ No newline at end of file
+}




More information about the jboss-cvs-commits mailing list