Added synchronization to prevent concurrent modification

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@602260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-12-07 22:47:10 +00:00
parent ddff5e5c16
commit 5628b3e4ba
1 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class MemoryTopicSub {
map.put(id, message);
}
void removeMessage(MessageId id) {
synchronized void removeMessage(MessageId id) {
map.remove(id);
if (map.isEmpty()) {
lastBatch = null;
@ -49,7 +49,7 @@ class MemoryTopicSub {
return map.size();
}
void recoverSubscription(MessageRecoveryListener listener) throws Exception {
synchronized void recoverSubscription(MessageRecoveryListener listener) throws Exception {
for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Entry)iter.next();
Object msg = entry.getValue();
@ -61,7 +61,7 @@ class MemoryTopicSub {
}
}
void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception {
synchronized void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception {
boolean pastLackBatch = lastBatch == null;
MessageId lastId = null;
// the message table is a synchronizedMap - so just have to synchronize
@ -88,7 +88,7 @@ class MemoryTopicSub {
}
void resetBatching() {
synchronized void resetBatching() {
lastBatch = null;
}
}