support a list of ConsumerId's from the network

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@636424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-12 17:08:48 +00:00
parent 22565e4176
commit 712254d5d2
1 changed files with 39 additions and 0 deletions

View File

@ -16,6 +16,9 @@
*/ */
package org.apache.activemq.command; package org.apache.activemq.command;
import java.util.ArrayList;
import java.util.List;
import org.apache.activemq.filter.BooleanExpression; import org.apache.activemq.filter.BooleanExpression;
import org.apache.activemq.state.CommandVisitor; import org.apache.activemq.state.CommandVisitor;
@ -54,6 +57,7 @@ public class ConsumerInfo extends BaseCommand {
protected BooleanExpression additionalPredicate; protected BooleanExpression additionalPredicate;
protected transient boolean networkSubscription; // this subscription protected transient boolean networkSubscription; // this subscription
protected transient List<ConsumerId> networkConsumerIds; // the original consumerId
// originated from a // originated from a
// network connection // network connection
@ -90,6 +94,13 @@ public class ConsumerInfo extends BaseCommand {
info.retroactive = retroactive; info.retroactive = retroactive;
info.priority = priority; info.priority = priority;
info.brokerPath = brokerPath; 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() { public boolean isDurable() {
@ -393,4 +404,32 @@ public class ConsumerInfo extends BaseCommand {
this.noRangeAcks = 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;
}
} }