diff options
Diffstat (limited to 'cadi/core/src/main/java')
-rw-r--r-- | cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java index d61aee21..4312c3ca 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java @@ -27,6 +27,7 @@ */ package org.onap.aaf.cadi.util; +import java.util.Iterator; import java.util.LinkedList; import org.onap.aaf.cadi.CadiException; @@ -210,11 +211,12 @@ public class Pool<T> { public boolean validate() { boolean rv = true; synchronized (list) { - for (Pooled<T> t : list) { + for (Iterator<Pooled<T>> iter = list.iterator(); iter.hasNext();) { + Pooled<T> t = iter.next(); if (!creator.isValid(t.content)) { rv = false; t.toss(); - list.remove(t); + iter.remove(); } } } |