removed a couple of possible concurrent accesses of the message collection

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@390041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-03-30 09:15:47 +00:00
parent 268a81b278
commit 2ed21cedd0
1 changed files with 8 additions and 2 deletions

View File

@ -98,7 +98,9 @@ public class Queue implements Destination {
public void recoverMessage(Message message) {
message.setRegionDestination(Queue.this);
MessageReference reference = createMessageReference(message);
messages.add(reference);
synchronized (messages) {
messages.add(reference);
}
reference.decrementReferenceCount();
destinationStatistics.getMessages().increment();
}
@ -326,8 +328,12 @@ public class Queue implements Destination {
}
public String toString() {
int size = 0;
synchronized (messages) {
size = message.size();
}
return "Queue: destination=" + destination.getPhysicalName() + ", subscriptions=" + consumers.size()
+ ", memory=" + usageManager.getPercentUsage() + "%, size=" + messages.size() + ", in flight groups="
+ ", memory=" + usageManager.getPercentUsage() + "%, size=" + size + ", in flight groups="
+ messageGroupOwners;
}