git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@561109 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-07-30 20:36:16 +00:00
parent 0e87c01f22
commit 350a2aad7f
6 changed files with 44 additions and 19 deletions

View File

@ -89,7 +89,7 @@ public class InactiveDurableSubscriptionView extends SubscriptionView implements
* @return name of the durable consumer * @return name of the durable consumer
*/ */
public String getSubscriptionName(){ public String getSubscriptionName(){
return subscriptionInfo.getSubcriptionName(); return subscriptionInfo.getSubscriptionName();
} }
/** /**
@ -125,7 +125,7 @@ public class InactiveDurableSubscriptionView extends SubscriptionView implements
public void destroy() throws Exception { public void destroy() throws Exception {
RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
info.setClientId(clientId); info.setClientId(clientId);
info.setSubcriptionName(subscriptionInfo.getSubcriptionName()); info.setSubcriptionName(subscriptionInfo.getSubscriptionName());
ConnectionContext context = new ConnectionContext(); ConnectionContext context = new ConnectionContext();
context.setBroker(broker); context.setBroker(broker);
context.setClientId(clientId); context.setClientId(clientId);

View File

@ -70,13 +70,13 @@ public class TopicRegion extends AbstractRegion {
lookup(context,destination); lookup(context,destination);
} }
String clientId=context.getClientId(); String clientId=context.getClientId();
String subcriptionName=info.getSubscriptionName(); String subscriptionName=info.getSubscriptionName();
SubscriptionKey key=new SubscriptionKey(clientId,subcriptionName); SubscriptionKey key=new SubscriptionKey(clientId,subscriptionName);
DurableTopicSubscription sub=(DurableTopicSubscription)durableSubscriptions.get(key); DurableTopicSubscription sub=(DurableTopicSubscription)durableSubscriptions.get(key);
if(sub!=null){ if(sub!=null){
if(sub.isActive()){ if(sub.isActive()){
throw new JMSException("Durable consumer is in use for client: "+clientId+" and subscriptionName: " throw new JMSException("Durable consumer is in use for client: "+clientId+" and subscriptionName: "
+subcriptionName); +subscriptionName);
} }
// Has the selector changed?? // Has the selector changed??
if(hasDurableSubChanged(info,sub.getConsumerInfo())){ if(hasDurableSubChanged(info,sub.getConsumerInfo())){
@ -189,7 +189,7 @@ public class TopicRegion extends AbstractRegion {
private ConsumerInfo createInactiveConsumerInfo(SubscriptionInfo info) { private ConsumerInfo createInactiveConsumerInfo(SubscriptionInfo info) {
ConsumerInfo rc = new ConsumerInfo(); ConsumerInfo rc = new ConsumerInfo();
rc.setSelector(info.getSelector()); rc.setSelector(info.getSelector());
rc.setSubscriptionName(info.getSubcriptionName()); rc.setSubscriptionName(info.getSubscriptionName());
rc.setDestination(info.getDestination()); rc.setDestination(info.getDestination());
rc.setConsumerId(createConsumerId()); rc.setConsumerId(createConsumerId());
return rc; return rc;

View File

@ -30,7 +30,7 @@ public class RemoveSubscriptionInfo extends BaseCommand {
protected ConnectionId connectionId; protected ConnectionId connectionId;
protected String clientId; protected String clientId;
protected String subcriptionName; protected String subscriptionName;
public byte getDataStructureType() { public byte getDataStructureType() {
@ -49,13 +49,25 @@ public class RemoveSubscriptionInfo extends BaseCommand {
/** /**
* @openwire:property version=1 * @openwire:property version=1
* @deprecated
*/ */
public String getSubcriptionName() { public String getSubcriptionName() {
return subcriptionName; return subscriptionName;
} }
public void setSubcriptionName(String subcriptionName) { /**
this.subcriptionName = subcriptionName; * @deprecated
*/
public void setSubcriptionName(String subscriptionName) {
this.subscriptionName = subscriptionName;
}
public String getSubscriptionName() {
return subscriptionName;
}
public void setSubscriptionName(String subscriptionName) {
this.subscriptionName = subscriptionName;
} }
/** /**

View File

@ -31,7 +31,7 @@ public class SubscriptionInfo implements DataStructure {
protected ActiveMQDestination destination; protected ActiveMQDestination destination;
protected String clientId; protected String clientId;
protected String subcriptionName; protected String subscriptionName;
protected String selector; protected String selector;
public byte getDataStructureType() { public byte getDataStructureType() {
@ -73,13 +73,26 @@ public class SubscriptionInfo implements DataStructure {
/** /**
* @openwire:property version=1 * @openwire:property version=1
* @deprecated
*/ */
public String getSubcriptionName() { public String getSubcriptionName() {
return subcriptionName; return subscriptionName;
} }
public void setSubcriptionName(String subcriptionName) { /**
this.subcriptionName = subcriptionName; * @param subscriptionName
* * @deprecated
*/
public void setSubcriptionName(String subscriptionName) {
this.subscriptionName = subscriptionName;
}
public String getSubscriptionName() {
return subscriptionName;
}
public void setSubscriptionName(String subscriptionName) {
this.subscriptionName = subscriptionName;
} }
public boolean isMarshallAware() { public boolean isMarshallAware() {
@ -92,7 +105,7 @@ public class SubscriptionInfo implements DataStructure {
public int hashCode() { public int hashCode() {
int h1 = clientId != null ? clientId.hashCode():-1; int h1 = clientId != null ? clientId.hashCode():-1;
int h2 = subcriptionName != null ? subcriptionName.hashCode():-1; int h2 = subscriptionName != null ? subscriptionName.hashCode():-1;
return h1 ^ h2; return h1 ^ h2;
} }
@ -102,8 +115,8 @@ public class SubscriptionInfo implements DataStructure {
SubscriptionInfo other=(SubscriptionInfo)obj; SubscriptionInfo other=(SubscriptionInfo)obj;
result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null
&&clientId.equals(other.clientId)) &&clientId.equals(other.clientId))
&&(subcriptionName==null&&other.subcriptionName==null||subcriptionName!=null &&(subscriptionName==null&&other.subscriptionName==null||subscriptionName!=null
&&other.subcriptionName!=null&&subcriptionName.equals(other.subcriptionName)); &&other.subscriptionName!=null&&subscriptionName.equals(other.subscriptionName));
} }
return result; return result;
} }

View File

@ -211,7 +211,7 @@ public class KahaReferenceStoreAdapter extends KahaPersistenceAdapter implements
for(Iterator i=durableSubscribers.iterator();i.hasNext();){ for(Iterator i=durableSubscribers.iterator();i.hasNext();){
SubscriptionInfo info=(SubscriptionInfo)i.next(); SubscriptionInfo info=(SubscriptionInfo)i.next();
TopicReferenceStore ts=createTopicReferenceStore((ActiveMQTopic)info.getDestination()); TopicReferenceStore ts=createTopicReferenceStore((ActiveMQTopic)info.getDestination());
ts.addSubsciption(info.getClientId(),info.getSubcriptionName(),info.getSelector(),false); ts.addSubsciption(info.getClientId(),info.getSubscriptionName(),info.getSelector(),false);
} }
} }

View File

@ -27,7 +27,7 @@ public class SubscriptionKey {
public SubscriptionKey(SubscriptionInfo info) { public SubscriptionKey(SubscriptionInfo info) {
this(info.getClientId(), info.getSubcriptionName()); this(info.getClientId(), info.getSubscriptionName());
} }
public SubscriptionKey(String clientId, String subscriptionName) { public SubscriptionKey(String clientId, String subscriptionName) {