src/share/classes/sun/font/SunLayoutEngine.java

Print this page

        

@@ -33,10 +33,11 @@
 import sun.font.GlyphLayout.*;
 import java.awt.geom.Point2D;
 import java.lang.ref.SoftReference;
 import java.util.HashMap;
 import java.util.Locale;
+import java.util.concurrent.ConcurrentHashMap;
 
 /*
  * different ways to do this
  * 1) each physical font2d keeps a hashtable mapping scripts to layout
  * engines, we query and fill this cache.

@@ -127,13 +128,14 @@
         return getEngine(new LayoutEngineKey(font, script, lang));
     }
 
   // !!! don't need this unless we have more than one sun layout engine...
     public LayoutEngine getEngine(LayoutEngineKey key) {
-        HashMap cache = (HashMap)cacheref.get();
+        // Using ConcurrentHashMap instead of HashMap to resolve 7027300
+        ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
         if (cache == null) {
-            cache = new HashMap();
+            cache = new ConcurrentHashMap();
             cacheref = new SoftReference(cache);
         }
 
         LayoutEngine e = (LayoutEngine)cache.get(key);
         if (e == null) {