From 350a2aad7ff67122dac1a075b26aa2e7ed7c130a Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 30 Jul 2007 20:36:16 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1305 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@561109 13f79535-47bb-0310-9956-ffa450edef68 --- .../jmx/InactiveDurableSubscriptionView.java | 4 +-- .../activemq/broker/region/TopicRegion.java | 8 +++--- .../command/RemoveSubscriptionInfo.java | 20 +++++++++++--- .../activemq/command/SubscriptionInfo.java | 27 ++++++++++++++----- .../kahadaptor/KahaReferenceStoreAdapter.java | 2 +- .../apache/activemq/util/SubscriptionKey.java | 2 +- 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java index faf55e8ba1..24c331e6e0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java @@ -89,7 +89,7 @@ public class InactiveDurableSubscriptionView extends SubscriptionView implements * @return name of the durable consumer */ public String getSubscriptionName(){ - return subscriptionInfo.getSubcriptionName(); + return subscriptionInfo.getSubscriptionName(); } /** @@ -125,7 +125,7 @@ public class InactiveDurableSubscriptionView extends SubscriptionView implements public void destroy() throws Exception { RemoveSubscriptionInfo info = new RemoveSubscriptionInfo(); info.setClientId(clientId); - info.setSubcriptionName(subscriptionInfo.getSubcriptionName()); + info.setSubcriptionName(subscriptionInfo.getSubscriptionName()); ConnectionContext context = new ConnectionContext(); context.setBroker(broker); context.setClientId(clientId); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java index 66b49182d1..57c9d05b3a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java @@ -70,13 +70,13 @@ public class TopicRegion extends AbstractRegion { lookup(context,destination); } String clientId=context.getClientId(); - String subcriptionName=info.getSubscriptionName(); - SubscriptionKey key=new SubscriptionKey(clientId,subcriptionName); + String subscriptionName=info.getSubscriptionName(); + SubscriptionKey key=new SubscriptionKey(clientId,subscriptionName); DurableTopicSubscription sub=(DurableTopicSubscription)durableSubscriptions.get(key); if(sub!=null){ if(sub.isActive()){ throw new JMSException("Durable consumer is in use for client: "+clientId+" and subscriptionName: " - +subcriptionName); + +subscriptionName); } // Has the selector changed?? if(hasDurableSubChanged(info,sub.getConsumerInfo())){ @@ -189,7 +189,7 @@ public class TopicRegion extends AbstractRegion { private ConsumerInfo createInactiveConsumerInfo(SubscriptionInfo info) { ConsumerInfo rc = new ConsumerInfo(); rc.setSelector(info.getSelector()); - rc.setSubscriptionName(info.getSubcriptionName()); + rc.setSubscriptionName(info.getSubscriptionName()); rc.setDestination(info.getDestination()); rc.setConsumerId(createConsumerId()); return rc; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/RemoveSubscriptionInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/RemoveSubscriptionInfo.java index 83478c78f8..b208dc3651 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/RemoveSubscriptionInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/RemoveSubscriptionInfo.java @@ -30,7 +30,7 @@ public class RemoveSubscriptionInfo extends BaseCommand { protected ConnectionId connectionId; protected String clientId; - protected String subcriptionName; + protected String subscriptionName; public byte getDataStructureType() { @@ -49,13 +49,25 @@ public class RemoveSubscriptionInfo extends BaseCommand { /** * @openwire:property version=1 + * @deprecated */ 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; } /** diff --git a/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java index 7202c06dc6..d114f8c67a 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java @@ -31,7 +31,7 @@ public class SubscriptionInfo implements DataStructure { protected ActiveMQDestination destination; protected String clientId; - protected String subcriptionName; + protected String subscriptionName; protected String selector; public byte getDataStructureType() { @@ -73,13 +73,26 @@ public class SubscriptionInfo implements DataStructure { /** * @openwire:property version=1 + * @deprecated */ 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() { @@ -92,7 +105,7 @@ public class SubscriptionInfo implements DataStructure { public int hashCode() { int h1 = clientId != null ? clientId.hashCode():-1; - int h2 = subcriptionName != null ? subcriptionName.hashCode():-1; + int h2 = subscriptionName != null ? subscriptionName.hashCode():-1; return h1 ^ h2; } @@ -102,8 +115,8 @@ public class SubscriptionInfo implements DataStructure { SubscriptionInfo other=(SubscriptionInfo)obj; result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null &&clientId.equals(other.clientId)) - &&(subcriptionName==null&&other.subcriptionName==null||subcriptionName!=null - &&other.subcriptionName!=null&&subcriptionName.equals(other.subcriptionName)); + &&(subscriptionName==null&&other.subscriptionName==null||subscriptionName!=null + &&other.subscriptionName!=null&&subscriptionName.equals(other.subscriptionName)); } return result; } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java index c18a2ffc87..a029a8e993 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java @@ -211,7 +211,7 @@ public class KahaReferenceStoreAdapter extends KahaPersistenceAdapter implements for(Iterator i=durableSubscribers.iterator();i.hasNext();){ SubscriptionInfo info=(SubscriptionInfo)i.next(); TopicReferenceStore ts=createTopicReferenceStore((ActiveMQTopic)info.getDestination()); - ts.addSubsciption(info.getClientId(),info.getSubcriptionName(),info.getSelector(),false); + ts.addSubsciption(info.getClientId(),info.getSubscriptionName(),info.getSelector(),false); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/util/SubscriptionKey.java b/activemq-core/src/main/java/org/apache/activemq/util/SubscriptionKey.java index 3956406e43..dd06655e06 100755 --- a/activemq-core/src/main/java/org/apache/activemq/util/SubscriptionKey.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/SubscriptionKey.java @@ -27,7 +27,7 @@ public class SubscriptionKey { public SubscriptionKey(SubscriptionInfo info) { - this(info.getClientId(), info.getSubcriptionName()); + this(info.getClientId(), info.getSubscriptionName()); } public SubscriptionKey(String clientId, String subscriptionName) {