activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r405206 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/AbstractConnection.java state/ConnectionState.java state/ConnectionStateTracker.java
Date Mon, 08 May 2006 22:41:10 GMT
Author: chirino
Date: Mon May  8 15:41:08 2006
New Revision: 405206

URL: http://svn.apache.org/viewcvs?rev=405206&view=rev
Log:
Connection state tracking would cause a CCE if temp destinations were in use.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java?rev=405206&r1=405205&r2=405206&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
Mon May  8 15:41:08 2006
@@ -25,7 +25,6 @@
 
 import org.apache.activemq.Service;
 import org.apache.activemq.broker.region.ConnectionStatistics;
-import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.command.Command;
 import org.apache.activemq.command.ConnectionControl;
@@ -372,7 +371,7 @@
         ConnectionState cs = lookupConnectionState(info.getConnectionId());
         broker.addDestinationInfo(cs.getContext(), info);
         if( info.getDestination().isTemporary() ) {
-            cs.addTempDestination(info.getDestination());
+            cs.addTempDestination(info);
         }
         return null;
     }
@@ -532,11 +531,11 @@
         
         // Cascade the connection stop to temp destinations.
         for (Iterator iter = cs.getTempDesinations().iterator(); iter.hasNext();) {
-            ActiveMQDestination dest = (ActiveMQDestination) iter.next();
+            DestinationInfo di = (DestinationInfo) iter.next();
             try{
-                broker.removeDestination(cs.getContext(), dest, 0);
+                broker.removeDestination(cs.getContext(), di.getDestination(), 0);
             }catch(Throwable e){
-               serviceLog.warn("Failed to remove tmp destination " + dest,e);
+               serviceLog.warn("Failed to remove tmp destination " + di.getDestination(),
e);
             }
             iter.remove();
         }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java?rev=405206&r1=405205&r2=405206&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java
Mon May  8 15:41:08 2006
@@ -20,11 +20,13 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConnectionInfo;
+import org.apache.activemq.command.DestinationInfo;
 import org.apache.activemq.command.SessionId;
 import org.apache.activemq.command.SessionInfo;
 
@@ -46,12 +48,17 @@
         return info.toString();
     }
 
-    public void addTempDestination(ActiveMQDestination destination) {
-        tempDestinations.add(destination);
+    public void addTempDestination(DestinationInfo info) {
+        tempDestinations.add(info);
     }
 
     public void removeTempDestination(ActiveMQDestination destination) {
-        tempDestinations.remove(destination);
+        for (Iterator iter = tempDestinations.iterator(); iter.hasNext();) {
+            DestinationInfo di = (DestinationInfo) iter.next();
+            if( di.getDestination().equals(destination) ) {
+                iter.remove();
+            }
+        }
     }
 
     public void addSession(SessionInfo info) {

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java?rev=405206&r1=405205&r2=405206&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
Mon May  8 15:41:08 2006
@@ -147,7 +147,7 @@
     public Response processAddDestination(DestinationInfo info) throws Exception {
         ConnectionState cs = (ConnectionState) connectionStates.get(info.getConnectionId());
         if( info.getDestination().isTemporary() ) {
-            cs.addTempDestination(info.getDestination());
+            cs.addTempDestination(info);
         }
         return TRACKED_RESPONSE_MARKER;
     }



Mime
View raw message