activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r730226 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: ActiveMQConnection.java command/ConnectionInfo.java
Date Tue, 30 Dec 2008 20:05:16 GMT
Author: djencks
Date: Tue Dec 30 12:05:16 2008
New Revision: 730226

URL: http://svn.apache.org/viewvc?rev=730226&view=rev
Log:
AMQ-2049 Fix race condition on ConnectionInfo by copying.  Minor javaodc cleanup

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConnectionInfo.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?rev=730226&r1=730225&r2=730226&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Tue Dec 30 12:05:16 2008
@@ -51,6 +51,7 @@
 import javax.jms.TopicConnection;
 import javax.jms.TopicSession;
 import javax.jms.XAConnection;
+import javax.jms.InvalidDestinationException;
 
 import org.apache.activemq.blob.BlobTransferPolicy;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -1332,11 +1333,11 @@
             if (isConnectionInfoSentToBroker || closed.get()) {
                 return;
             }
-    
+            //TODO shouldn't this check be on userSpecifiedClientID rather than the value
of clientID?
             if (info.getClientId() == null || info.getClientId().trim().length() == 0) {
                 info.setClientId(clientIdGenerator.generateId());
             }
-            syncSendPacket(info);
+            syncSendPacket(info.copy());
     
             this.isConnectionInfoSentToBroker = true;
             // Add a temp destination advisory consumer so that
@@ -2043,7 +2044,7 @@
      *                 specified.
      * @since 1.1
      */
-    public void unsubscribe(String name) throws JMSException {
+    public void unsubscribe(String name) throws InvalidDestinationException, JMSException
{
         checkClosedOrFailed();
         RemoveSubscriptionInfo rsi = new RemoveSubscriptionInfo();
         rsi.setConnectionId(getConnectionInfo().getConnectionId());

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConnectionInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConnectionInfo.java?rev=730226&r1=730225&r2=730226&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConnectionInfo.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConnectionInfo.java
Tue Dec 30 12:05:16 2008
@@ -48,14 +48,23 @@
         return DATA_STRUCTURE_TYPE;
     }
 
-    public void copy(ConnectionInfo copy) {
+    public ConnectionInfo copy() {
+        ConnectionInfo copy = new ConnectionInfo();
+        copy(copy);
+        return copy;
+    }
+
+    private void copy(ConnectionInfo copy) {
         super.copy(copy);
+        copy.connectionId = connectionId;
         copy.clientId = clientId;
         copy.userName = userName;
         copy.password = password;
         copy.brokerPath = brokerPath;
         copy.brokerMasterConnector = brokerMasterConnector;
         copy.manageable = manageable;
+        copy.clientMaster = clientMaster;
+        copy.transportContext = transportContext;
     }
 
     /**
@@ -133,7 +142,7 @@
     }
 
     /**
-     * @param brokerMasterConnector The brokerMasterConnector to set.
+     * @param slaveBroker The brokerMasterConnector to set.
      */
     public void setBrokerMasterConnector(boolean slaveBroker) {
         this.brokerMasterConnector = slaveBroker;



Mime
View raw message