synchronize around the messagesWaitingForSpace

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@633808 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-05 10:17:43 +00:00
parent f6fd249d8c
commit e7316df001
1 changed files with 5 additions and 3 deletions

View File

@ -505,9 +505,11 @@ public class Topic extends BaseDestination implements Task{
} }
public boolean iterate() { public boolean iterate() {
while (!memoryUsage.isFull() && !messagesWaitingForSpace.isEmpty()) { synchronized(messagesWaitingForSpace) {
Runnable op = messagesWaitingForSpace.removeFirst(); while (!memoryUsage.isFull() && !messagesWaitingForSpace.isEmpty()) {
op.run(); Runnable op = messagesWaitingForSpace.removeFirst();
op.run();
}
} }
return false; return false;
} }