DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=41044>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41044 ------- Additional Comments From [EMAIL PROTECTED] 2007-06-30 08:47 ------- Some more brainstorming about correcting the ideas: Make the PropertyCache more than a simple wrapper around a WeakHashMap, and instead of giving each Property type its own cache, make the Map multi-dimensional (or an array of WeakHashMaps?) The base Map would be, for example, a mapping of Class objects to a WeakHashMap, which would then contain the canonical instances for a particular Property type. Something like: public final class PropertyCache { private static Map typeCache = new HashMap(); private static Map propCache; /** * Checks if the given property is present in the cache - if so, returns * a reference to the cached value. Otherwise the given object is added * to the cache and returned. * @param obj * @return the cached instance */ public static synchronized Property fetch(Property prop) { Class propType = prop.getClass(); propCache = (Map) typeCache.get(propType); if (propCache == null) { propCache = new WeakHashMap(); propCache.put(prop, prop); typeCache.put(propType, propCache); return prop; } else { Property cacheEntry = (Property) propCache.get(prop); if (cacheEntry != null) { return cacheEntry; } else { propCache.put(prop, prop); return prop; } } } } The PropertyMakers, in their turn, will use this cache whenever they receive a Property from the PropertyParser that can be safely canonicalized (absolute lengths, enums, strings, ...). If the Property they receive from the parser is a relative one, they bypass the cache and make sure to return the new instance. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
