avoid concurrent modification exception on linux

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@550796 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-06-26 13:04:40 +00:00
parent f6e1ac7f97
commit 8a5387f6ad
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@ package org.apache.activemq.memory;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.activemq.Service;
@ -326,7 +327,7 @@ public class UsageManager implements Service{
if(oldPercentUsage>=100&&newPercentUsage<100){
synchronized(usageMutex){
usageMutex.notifyAll();
for (Iterator iter = callbacks.iterator(); iter.hasNext();) {
for (Iterator iter = new ArrayList<Runnable>(callbacks).iterator(); iter.hasNext();) {
Runnable callback = (Runnable) iter.next();
callback.run();
}