[jboss-cvs] JBoss Messaging SVN: r8522 - in branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms: tx and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 12 18:33:29 EDT 2012


Author: bershath27
Date: 2012-04-12 18:33:21 -0400 (Thu, 12 Apr 2012)
New Revision: 8522

Modified:
   branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/client/container/StateCreationAspect.java
   branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/tx/MessagingXAResource.java
Log:
JBPAPP-8680


Modified: branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2012-04-12 14:30:32 UTC (rev 8521)
+++ branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/client/container/StateCreationAspect.java	2012-04-12 22:33:21 UTC (rev 8522)
@@ -103,6 +103,11 @@
                                 connectionDelegate.getMaxRetryChangeRate(), connectionDelegate.getRetryChangeRateInterval(),
                                 connectionDelegate.getMinTimeoutProcessTime());
 
+         MethodInvocation mi = (MethodInvocation)inv;
+         String username = (String)mi.getArguments()[0];
+         
+         connectionState.setUsername(username);
+
          remotingConnection.getConnectionListener().setConnectionState(connectionState);
          remotingConnection.getConnectionListener().start();
           

Modified: branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/tx/MessagingXAResource.java	2012-04-12 14:30:32 UTC (rev 8521)
+++ branches/JBossMessaging_1_4_8_SP5_JBMESSAGING-1920/src/main/org/jboss/jms/tx/MessagingXAResource.java	2012-04-12 22:33:21 UTC (rev 8522)
@@ -21,6 +21,7 @@
   */
 package org.jboss.jms.tx;
 
+import org.jboss.jms.client.state.ConnectionState;
 import org.jboss.jms.client.state.SessionState;
 import org.jboss.jms.delegate.ConnectionDelegate;
 import org.jboss.jms.exception.MessagingXAException;
@@ -109,9 +110,28 @@
          return false;
       }
       
-      boolean same = (((MessagingXAResource)xaResource).rm.getServerID() == this.rm.getServerID())
-                  && (((MessagingXAResource)xaResource).rm.getTransactions() == this.rm.getTransactions());
+      MessagingXAResource otherResource = (MessagingXAResource)xaResource;
       
+      boolean same = (otherResource.rm.getServerID() == this.rm.getServerID())
+                  && (otherResource.rm.getTransactions() == this.rm.getTransactions());
+
+      if (same)
+      {
+         //if user is different, then don't do it
+         ConnectionState state = (ConnectionState)sessionState.getParent();
+         ConnectionState otherState = (ConnectionState)otherResource.sessionState.getParent();
+         String u1 = state.getUsername();
+         String u2 = otherState.getUsername();
+         if (u1 != null)
+         {
+            same = u1.equals(u2);
+         }
+         else if (u2 != null)
+         {
+            same = false;
+         }
+      }
+
       if (trace) { log.trace("Calling isSameRM, result is " + same + " " + ((MessagingXAResource)xaResource).rm.getServerID() + " " + this.rm.getServerID()); }
             
       return same;



More information about the jboss-cvs-commits mailing list