activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r573395 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: kaha/ContainerId.java store/kahadaptor/KahaTopicReferenceStore.java
Date Thu, 06 Sep 2007 22:11:43 GMT
Author: chirino
Date: Thu Sep  6 15:11:43 2007
New Revision: 573395

URL: http://svn.apache.org/viewvc?rev=573395&view=rev
Log:
Fixed ContainerId so that it also uses the container name when it compares equality. Switch
back to using a single index file
for the topic susbcriptions lists.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java?rev=573395&r1=573394&r2=573395&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/ContainerId.java Thu
Sep  6 15:11:43 2007
@@ -68,16 +68,15 @@
     }
 
     public int hashCode() {
-        return key.hashCode();
+        return key.hashCode() ^ dataContainerName.hashCode();
     }
 
     public boolean equals(Object obj) {
-        boolean result = false;
-        if (obj != null && obj instanceof ContainerId) {
-            ContainerId other = (ContainerId)obj;
-            result = other.key.equals(this.key);
+        if (obj == null || obj.getClass() != ContainerId.class) {
+            return false;
         }
-        return result;
+        ContainerId other = (ContainerId)obj;
+        return other.key.equals(this.key) && other.dataContainerName.equals(this.dataContainerName);
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java?rev=573395&r1=573394&r2=573395&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaTopicReferenceStore.java
Thu Sep  6 15:11:43 2007
@@ -50,9 +50,9 @@
         this.ackContainer = ackContainer;
         subscriberContainer = subsContainer;
         // load all the Ack containers
-        for (Iterator<String> i = subscriberContainer.keySet().iterator(); i.hasNext();)
{
-            String key = i.next();
-            addSubscriberMessageContainer(key);
+        for (Iterator<SubscriptionInfo> i = subscriberContainer.values().iterator();
i.hasNext();) {
+            SubscriptionInfo info = i.next();
+            addSubscriberMessageContainer(info.getClientId(), info.getSubscriptionName());
         }
     }
 
@@ -108,12 +108,12 @@
         }
     }
 
-    protected ListContainer addSubscriberMessageContainer(String key) throws IOException
{
-        ListContainer container = store.getListContainer(key, "TSR-" + destination);
+    protected ListContainer addSubscriberMessageContainer(String clientId, String subscriptionName)
throws IOException {
+        ListContainer container = store.getListContainer(clientId+":"+subscriptionName+":"+destination.getQualifiedName(),
"topic-subs-references");
         Marshaller marshaller = new ConsumerMessageRefMarshaller();
         container.setMarshaller(marshaller);
         TopicSubContainer tsc = new TopicSubContainer(container);
-        subscriberMessages.put(key, tsc);
+        subscriberMessages.put(getSubscriptionKey(clientId, subscriptionName), tsc);
         return container;
     }
 
@@ -156,7 +156,7 @@
             adapter.addSubscriberState(info);
         }
         // add the subscriber
-        ListContainer container = addSubscriberMessageContainer(key);
+        ListContainer container = addSubscriberMessageContainer(info.getClientId(), info.getSubscriptionName());
         if (retroactive) {
             /*
              * for(StoreEntry



Mime
View raw message