activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r637046 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java
Date Fri, 14 Mar 2008 10:44:53 GMT
Author: rajdavies
Date: Fri Mar 14 03:44:52 2008
New Revision: 637046

URL: http://svn.apache.org/viewvc?rev=637046&view=rev
Log:
Don't check connection splits for temporary destinations

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java?rev=637046&r1=637045&r2=637046&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/cluster/ConnectionSplitBroker.java
Fri Mar 14 03:44:52 2008
@@ -23,6 +23,7 @@
 import org.apache.activemq.broker.BrokerFilter;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.broker.region.Subscription;
+import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConsumerId;
 import org.apache.activemq.command.ConsumerInfo;
 import org.apache.commons.logging.Log;
@@ -44,31 +45,34 @@
 
         
     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws
Exception{
-       
-        synchronized (networkConsumerList) {
-            if (info.isNetworkSubscription()) {
-                networkConsumerList.add(info);
-            } else {
-                if(!networkConsumerList.isEmpty()) {
-                    List<ConsumerInfo> gcList = new ArrayList<ConsumerInfo>();
-                    for (ConsumerInfo nc : networkConsumerList) {
-                        if (!nc.isNetworkConsumersEmpty()) {
-                            for (ConsumerId id : nc.getNetworkConsumerIds()) {
-                                if (id.equals(info.getConsumerId())) {
-                                    nc.removeNetworkConsumerId(id);
-                                    if (nc.isNetworkConsumersEmpty()) {
-                                        gcList.add(nc);
+        ActiveMQDestination dest = info.getDestination();
+        boolean validDestination = dest != null && !dest.isTemporary();
+        if (validDestination) {
+            synchronized (networkConsumerList) {
+                if (info.isNetworkSubscription()) {
+                    networkConsumerList.add(info);
+                } else {
+                    if(!networkConsumerList.isEmpty()) {
+                        List<ConsumerInfo> gcList = new ArrayList<ConsumerInfo>();
+                        for (ConsumerInfo nc : networkConsumerList) {
+                            if (!nc.isNetworkConsumersEmpty()) {
+                                for (ConsumerId id : nc.getNetworkConsumerIds()) {
+                                    if (id.equals(info.getConsumerId())) {
+                                        nc.removeNetworkConsumerId(id);
+                                        if (nc.isNetworkConsumersEmpty()) {
+                                            gcList.add(nc);
+                                        }
                                     }
                                 }
+                            } else {
+                                gcList.add(nc);
                             }
-                        } else {
-                            gcList.add(nc);
                         }
-                    }
-                    for (ConsumerInfo nc : gcList) {
-                        networkConsumerList.remove(nc);
-                        super.removeConsumer(context, nc);
-                        LOG.warn("Removed stale network consumer " + nc);
+                        for (ConsumerInfo nc : gcList) {
+                            networkConsumerList.remove(nc);
+                            super.removeConsumer(context, nc);
+                            LOG.warn("Removed stale network consumer " + nc);
+                        }
                     }
                 }
             }



Mime
View raw message