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

Print this page

        

*** 33,42 **** --- 33,43 ---- 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,139 **** 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(); if (cache == null) { ! cache = new HashMap(); cacheref = new SoftReference(cache); } LayoutEngine e = (LayoutEngine)cache.get(key); if (e == null) { --- 128,141 ---- 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) { ! // Using ConcurrentHashMap instead of HashMap to resolve 7027300 ! ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get(); if (cache == null) { ! cache = new ConcurrentHashMap(); cacheref = new SoftReference(cache); } LayoutEngine e = (LayoutEngine)cache.get(key); if (e == null) {