Commit bc539c97 authored by Alexander Diewald's avatar Alexander Diewald

Persistency: Iterate only over copied listener lists

This allows listeners to deregister themselves. Otherwise, a
ConcurrentModificationException will occut. This change ensures that the
set of listeners remains the same while notifying all registered ones.

Issue-Ref: 3993
Issue-Url: https://af3-developer.fortiss.org/issues/3993Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 1b96b720
......@@ -7,7 +7,7 @@ LibraryPrototypeProvider.java b77eddbdca78f561ffb1233e98817be361c690ae GREEN
LibraryService.java d22671ba820466062852c15873698adf28960d94 GREEN
LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN
MigrationService.java 2f800eac9793aa736089a802bbfc2c4c1c09770d GREEN
PersistencyService.java 103eef642c038ef63fa49b743d803aaa3fea2724 GREEN
PersistencyService.java aae74583d4316bd540be71f47ebae8b0a0dd9910 YELLOW
PrototypeService.java cf8e6fa96ba9c2f65b24400054ed68e93238a975 GREEN
ToolingKernelInternal.java f6e7114825748683c7f1d040b41ab854a6c4d79b GREEN
TransformationService.java 3cdb86fe920158f93cd9466c6ef9697b2dd8ca7f GREEN
......
......@@ -246,21 +246,21 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe
/** Notifies listener about top-level element loading (startup). */
private synchronized void notifyListenersAboutLoad(ITopLevelElement top) {
for(IPersistencyServiceListener listener : listeners) {
for(IPersistencyServiceListener listener : asUnmodifiable(listeners)) {
listener.topLevelElementLoaded(top);
}
}
/** Notifies listener about top-level element adding. */
private synchronized void notifyListenersAboutAdd(ITopLevelElement top) {
for(IPersistencyServiceListener listener : listeners) {
for(IPersistencyServiceListener listener : asUnmodifiable(listeners)) {
listener.topLevelElementAdded(top);
}
}
/** Notifies listener about top-level element removal. */
private synchronized void notifyListenersAboutRemove(ITopLevelElement top) {
for(IPersistencyServiceListener listener : listeners) {
for(IPersistencyServiceListener listener : asUnmodifiable(listeners)) {
listener.topLevelElementRemoved(top);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment