activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1489471 - in /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region: DestinationFilter.java TopicRegion.java virtual/VirtualTopicInterceptor.java
Date Tue, 04 Jun 2013 15:27:35 GMT
Author: tabish
Date: Tue Jun  4 15:27:18 2013
New Revision: 1489471

URL: http://svn.apache.org/r1489471
Log:
Fix for: https://issues.apache.org/jira/browse/AMQ-4571

test case for AMQ-4356 validates this

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationFilter.java
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationFilter.java?rev=1489471&r1=1489470&r2=1489471&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationFilter.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/DestinationFilter.java
Tue Jun  4 15:27:18 2013
@@ -33,6 +33,7 @@ import org.apache.activemq.command.Produ
 import org.apache.activemq.store.MessageStore;
 import org.apache.activemq.usage.MemoryUsage;
 import org.apache.activemq.usage.Usage;
+import org.apache.activemq.util.SubscriptionKey;
 
 /**
  *
@@ -386,4 +387,10 @@ public class DestinationFilter implement
     public boolean isDLQ() {
         return next.isDLQ();
     }
+
+    public void deleteSubscription(ConnectionContext context, SubscriptionKey key) throws
Exception {
+        if (next instanceof Topic) {
+            ((Topic) next).deleteSubscription(context, key);
+        }
+    }
 }

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicRegion.java?rev=1489471&r1=1489470&r2=1489471&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicRegion.java
Tue Jun  4 15:27:18 2013
@@ -31,7 +31,6 @@ import javax.jms.JMSException;
 import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.virtual.VirtualTopicInterceptor;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConnectionId;
 import org.apache.activemq.command.ConsumerId;
@@ -198,9 +197,9 @@ public class TopicRegion extends Abstrac
                 if (dest instanceof Topic){
                     Topic topic = (Topic)dest;
                     topic.deleteSubscription(context, key);
-                } else if (dest instanceof VirtualTopicInterceptor) {
-                    VirtualTopicInterceptor virtualTopic = (VirtualTopicInterceptor) dest;
-                    virtualTopic.getTopic().deleteSubscription(context, key);
+                } else if (dest instanceof DestinationFilter) {
+                    DestinationFilter filter = (DestinationFilter) dest;
+                    filter.deleteSubscription(context, key);
                 }
             }
         } finally {

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java?rev=1489471&r1=1489470&r2=1489471&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java
Tue Jun  4 15:27:18 2013
@@ -26,15 +26,14 @@ import org.apache.activemq.command.Messa
 import org.apache.activemq.util.LRUCache;
 
 /**
- * A Destination which implements <a
- * href="http://activemq.org/site/virtual-destinations.html">Virtual Topic</a>
+ * A Destination which implements <a href="http://activemq.org/site/virtual-destinations.html">Virtual
Topic</a>
  */
 public class VirtualTopicInterceptor extends DestinationFilter {
 
     private final String prefix;
     private final String postfix;
     private final boolean local;
-    private final LRUCache<ActiveMQDestination,ActiveMQQueue> cache = new LRUCache<ActiveMQDestination,ActiveMQQueue>();
+    private final LRUCache<ActiveMQDestination, ActiveMQQueue> cache = new LRUCache<ActiveMQDestination,
ActiveMQQueue>();
 
     public VirtualTopicInterceptor(Destination next, String prefix, String postfix, boolean
local) {
         super(next);
@@ -58,11 +57,11 @@ public class VirtualTopicInterceptor ext
 
     protected ActiveMQDestination getQueueConsumersWildcard(ActiveMQDestination original)
{
         ActiveMQQueue queue;
-        synchronized(cache){
+        synchronized (cache) {
             queue = cache.get(original);
-            if (queue==null){
+            if (queue == null) {
                 queue = new ActiveMQQueue(prefix + original.getPhysicalName() + postfix);
-                cache.put(original,queue);
+                cache.put(original, queue);
             }
         }
         return queue;



Mime
View raw message