mirror of https://github.com/apache/openjpa.git
OPENJPA-2725 - fix ConcurrentModificationException during unrefed dependents cleanup / thanks @eran-levy - This closes #9
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1819982 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b4c13fc0ed
commit
14d4b8007c
|
@ -2149,8 +2149,14 @@ public class BrokerImpl implements Broker, FindCallbacks, Cloneable, Serializabl
|
|||
// dependents
|
||||
_flags |= FLAG_DEREFDELETING;
|
||||
if (flush && _derefCache != null && !_derefCache.isEmpty()) {
|
||||
for (Iterator<StateManagerImpl> itr = _derefCache.iterator(); itr.hasNext();)
|
||||
deleteDeref(itr.next());
|
||||
Set<StateManagerImpl> statesMarkedForDelete = new HashSet<>();
|
||||
// mark for delete all elements in deref, otherwise in some situations it
|
||||
// throws ConcurrentModificationException
|
||||
statesMarkedForDelete.addAll(_derefCache);
|
||||
for (StateManagerImpl state: statesMarkedForDelete) {
|
||||
deleteDeref(state);
|
||||
}
|
||||
|
||||
flushAdditions(transactional, reason);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue