Index: src/main/java/org/apache/jackrabbit/core/state/CacheManager.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/CacheManager.java (revision 572729) +++ src/main/java/org/apache/jackrabbit/core/state/CacheManager.java (working copy) @@ -53,8 +53,8 @@ /** The set of caches (weakly referenced). */ private WeakHashMap caches = new WeakHashMap(); - /** Rebalance the caches each ... milliseconds at most. */ - private static final int SLEEP = 1000; + /** The default minimum interval between cache resizing (in ms). */ + private static final int DEFAULT_MIN_RESIZE_INTERVAL = 10000; /** The size of a big object, to detect if a cache is full or not. */ private static final int BIG_OBJECT_SIZE = 16 * 1024; @@ -67,9 +67,12 @@ /** The maximum memory per cache (unless, there is some unused memory). */ private long maxMemoryPerCache = DEFAULT_MAX_MEMORY_PER_CACHE; + + /** Rebalance the caches each ... milliseconds at most. */ + private long minResizeInterval = DEFAULT_MIN_RESIZE_INTERVAL; /** The last time the caches where resized. */ - private volatile long nextResize = System.currentTimeMillis() + SLEEP; + private volatile long nextResize = System.currentTimeMillis() + DEFAULT_MIN_RESIZE_INTERVAL; public long getMaxMemory() { @@ -95,9 +98,16 @@ public void setMinMemoryPerCache(final long minMemoryPerCache) { this.minMemoryPerCache = minMemoryPerCache; } - - /** + public long getMinResizeInterval() { + return minResizeInterval; + } + + public void setMinResizeInterval(long minResizeInterval) { + this.minResizeInterval = minResizeInterval; + } + + /** * After one of the caches is accessed a number of times, this method is called. * Resize the caches if required. */ @@ -112,9 +122,9 @@ if (now < nextResize) { return; } - nextResize = now + SLEEP; + nextResize = now + minResizeInterval; resizeAll(); - nextResize = System.currentTimeMillis() + SLEEP; + nextResize = System.currentTimeMillis() + minResizeInterval; } }