6636331: ConcurrentModificationException in AppContext code

Added synchronization to AppContext.getAppContexts()

Reviewed-by: art
This commit is contained in:
Oleg Sukhodolsky 2008-03-13 16:51:04 +03:00
parent 59d9653ecf
commit 794142ee36

View File

@ -146,7 +146,9 @@ public final class AppContext {
* Returns a set containing all <code>AppContext</code>s.
*/
public static Set<AppContext> getAppContexts() {
return new HashSet<AppContext>(threadGroup2appContext.values());
synchronized (threadGroup2appContext) {
return new HashSet<AppContext>(threadGroup2appContext.values());
}
}
/* The main "system" AppContext, used by everything not otherwise