diff --git a/jdk/src/share/classes/sun/awt/AppContext.java b/jdk/src/share/classes/sun/awt/AppContext.java
index 0370f8333a3..901be0b9a1b 100644
--- a/jdk/src/share/classes/sun/awt/AppContext.java
+++ b/jdk/src/share/classes/sun/awt/AppContext.java
@@ -146,7 +146,9 @@ public final class AppContext {
* Returns a set containing all AppContext
s.
*/
public static Set getAppContexts() {
- return new HashSet(threadGroup2appContext.values());
+ synchronized (threadGroup2appContext) {
+ return new HashSet(threadGroup2appContext.values());
+ }
}
/* The main "system" AppContext, used by everything not otherwise