[jboss-cvs] JBoss Messaging SVN: r2206 - trunk/src/main/org/jboss/jms/server/endpoint.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 8 12:42:57 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-02-08 12:42:56 -0500 (Thu, 08 Feb 2007)
New Revision: 2206

Modified:
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-809 - improving checkDuplicates on transactions (only checking first send)

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-08 16:39:30 UTC (rev 2205)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-08 17:42:56 UTC (rev 2206)
@@ -716,7 +716,11 @@
                                    Transaction tx, boolean checkForDuplicates) throws Throwable
    {
       if (trace) { log.trace(this + " processing transaction " + tx); }
-         
+
+      // used on checkForDuplicates...
+      // we only check the first iteration
+      boolean firstIteration = true;
+
       synchronized (sessions)
       {         
          for (Iterator i = txState.getSessionStates().iterator(); i.hasNext(); )
@@ -724,10 +728,23 @@
             SessionTxState sessionState = (SessionTxState)i.next();
 
             // send the messages
-            
+
             for (Iterator j = sessionState.getMsgs().iterator(); j.hasNext(); )
             {
-               sendMessage((JBossMessage)j.next(), tx, checkForDuplicates);
+               JBossMessage message = (JBossMessage)j.next();
+               if (checkForDuplicates && firstIteration)
+               {
+                  firstIteration = false;
+                  if (serverPeer.getPersistenceManagerInstance().
+                     referenceExists(message.getMessageID()))
+                  {
+                     // This means the transaction was previously completed...
+                     // we are done here then... no need to even check for ACKs or anything else
+                     log.debug("Transaction " + tx + " was previously completed, ignoring call");
+                     return;
+                  }
+               }
+               sendMessage(message, tx, false);
             }
 
             // send the acks




More information about the jboss-cvs-commits mailing list