activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r636424 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConsumerInfo.java
Date Wed, 12 Mar 2008 17:09:07 GMT
Author: rajdavies
Date: Wed Mar 12 10:08:48 2008
New Revision: 636424

URL: http://svn.apache.org/viewvc?rev=636424&view=rev
Log:
support a list of ConsumerId's from the network

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConsumerInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConsumerInfo.java?rev=636424&r1=636423&r2=636424&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConsumerInfo.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ConsumerInfo.java
Wed Mar 12 10:08:48 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq.command;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.activemq.filter.BooleanExpression;
 import org.apache.activemq.state.CommandVisitor;
 
@@ -54,6 +57,7 @@
 
     protected BooleanExpression additionalPredicate;
     protected transient boolean networkSubscription; // this subscription
+    protected transient List<ConsumerId> networkConsumerIds; // the original consumerId
 
     // originated from a
     // network connection
@@ -90,6 +94,13 @@
         info.retroactive = retroactive;
         info.priority = priority;
         info.brokerPath = brokerPath;
+        info.networkSubscription = networkSubscription;
+        if (networkConsumerIds != null) {
+            if (info.networkConsumerIds==null){
+                info.networkConsumerIds=new ArrayList<ConsumerId>();
+            }
+            info.networkConsumerIds.addAll(networkConsumerIds);
+        }
     }
 
     public boolean isDurable() {
@@ -391,6 +402,34 @@
 
     public void setNoRangeAcks(boolean noRangeAcks) {
         this.noRangeAcks = noRangeAcks;
+    }
+
+    public synchronized void addNetworkConsumerId(ConsumerId networkConsumerId) {
+        if (networkConsumerIds == null) {
+            networkConsumerIds = new ArrayList<ConsumerId>();
+        }
+        networkConsumerIds.add(networkConsumerId);
+    }
+
+    public synchronized void removeNetworkConsumerId(ConsumerId networkConsumerId) {
+        if (networkConsumerIds != null) {
+            networkConsumerIds.remove(networkConsumerId);
+            if (networkConsumerIds.isEmpty()) {
+                networkConsumerIds=null;
+            }
+        }
+    }
+    
+    public synchronized boolean isNetworkConsumersEmpty() {
+        return networkConsumerIds == null || networkConsumerIds.isEmpty();
+    }
+    
+    public synchronized List<ConsumerId> getNetworkConsumerIds(){
+        List<ConsumerId> result = new ArrayList<ConsumerId>();
+        if (networkConsumerIds != null) {
+            result.addAll(networkConsumerIds);
+        }
+        return result;
     }
 
 }



Mime
View raw message