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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 24 10:26:45 EDT 2008


Author: adrian at jboss.org
Date: 2008-06-24 10:26:45 -0400 (Tue, 24 Jun 2008)
New Revision: 74987

Modified:
   branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyMessageConsumer.java
Log:
[JBAS-5670] - NACK messages that will never be delivered in MessageConsumer.close()

Modified: branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyMessageConsumer.java
===================================================================
--- branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyMessageConsumer.java	2008-06-24 13:59:40 UTC (rev 74986)
+++ branches/Branch_4_2/messaging/src/main/org/jboss/mq/SpyMessageConsumer.java	2008-06-24 14:26:45 UTC (rev 74987)
@@ -525,6 +525,21 @@
 
          if (trace)      
             log.trace("Message consumer closing. " + this);
+         
+         while (messages.isEmpty() == false)
+         {
+            SpyMessage mes = (SpyMessage) messages.removeFirst();
+            if (trace)
+               log.trace("close() nacking undelivered message mes=" + mes.getJMSMessageID() + " " + this); 
+            try
+            {
+               session.connection.send(mes.getAcknowledgementRequest(false));
+            }
+            catch (Exception e)
+            {
+               log.debug("Error nacking message: " + mes.getJMSMessageID(), e);
+            }
+         }
          messages.notifyAll();
       }
       




More information about the jboss-cvs-commits mailing list