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.



git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@573395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-09-06 22:11:43 +00:00
parent 838e9a42b4
commit b81dd2886e
2 changed files with 12 additions and 13 deletions

View File

@ -68,16 +68,15 @@ public class ContainerId implements Externalizable {
}
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 {

View File

@ -50,9 +50,9 @@ public class KahaTopicReferenceStore extends KahaReferenceStore implements Topic
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 @@ public class KahaTopicReferenceStore extends KahaReferenceStore implements Topic
}
}
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 @@ public class KahaTopicReferenceStore extends KahaReferenceStore implements Topic
adapter.addSubscriberState(info);
}
// add the subscriber
ListContainer container = addSubscriberMessageContainer(key);
ListContainer container = addSubscriberMessageContainer(info.getClientId(), info.getSubscriptionName());
if (retroactive) {
/*
* for(StoreEntry