mirror of https://github.com/apache/activemq.git
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:
parent
ddff5e5c16
commit
5628b3e4ba
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue