Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Version 1.0.3
-
None
-
None
-
WinXP, jdk 1.4.2_05
Description
In org.apache.xmlbeans.impl.store.Path
Several HashMaps are used to cache paths and queries:
private static Map _xqrlPathCache = new HashMap();
private static Map _xbeanPathCache = new HashMap();
private static Map _xqrlQueryCache = new HashMap();
These caches are then used to store paths and queries as the queries are performed.
This cache is not managed so as the number of unique queries grows so does the cache.
Because the cache is not internally managed by xmlbeans the user should be allowed to set some limit to the cache size to prevent an over utilization of memory.
Below is a snippet of code to illustrate my idea of a sized cache.
private static HashMap _xqrlPathCache = new CacheMap();
private static HashMap _xbeanPathCache = new CacheMap();
private static HashMap _xqrlQueryCache = new CacheMap();
private static class CacheMap extends LinkedHashMap
{
private static final String XPATH_CACHE_SIZE = "xpathCacheSize";
private static int MAX_ENTRIES = -1;
static{
String size = null;
if((size = System.getProperty(XPATH_CACHE_SIZE)) != null){
try
catch(Exception e)
{ //There's no other logging in here otherwise I would spit out a message } }
}