Author: remy.maucherat(a)jboss.com
Date: 2012-01-06 05:24:41 -0500 (Fri, 06 Jan 2012)
New Revision: 1914
Modified:
trunk/java/org/apache/naming/resources/ProxyDirContext.java
trunk/java/org/apache/naming/resources/ResourceCache.java
trunk/webapps/docs/changelog.xml
Log:
With the low memory flag enabled, it could be possible the not found entry gets bigger
than the cache size,
causing problems, so use a better default.
Modified: trunk/java/org/apache/naming/resources/ProxyDirContext.java
===================================================================
--- trunk/java/org/apache/naming/resources/ProxyDirContext.java 2012-01-05 16:10:52 UTC
(rev 1913)
+++ trunk/java/org/apache/naming/resources/ProxyDirContext.java 2012-01-06 10:24:41 UTC
(rev 1914)
@@ -73,8 +73,6 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
-import org.apache.naming.NamingContextBindingsEnumeration;
-import org.apache.naming.NamingContextEnumeration;
import org.apache.naming.NamingEnumerationImpl;
import org.apache.naming.StringManager;
@@ -122,6 +120,7 @@
cache = new ResourceCache();
}
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize());
+ cache.setSpareNotFoundEntries(baseDirContext.getCacheMaxSize()/8);
cacheTTL = baseDirContext.getCacheTTL();
cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
// cacheObjectMaxSize must be less than cacheMaxSize
Modified: trunk/java/org/apache/naming/resources/ResourceCache.java
===================================================================
--- trunk/java/org/apache/naming/resources/ResourceCache.java 2012-01-05 16:10:52 UTC (rev
1913)
+++ trunk/java/org/apache/naming/resources/ResourceCache.java 2012-01-06 10:24:41 UTC (rev
1914)
@@ -210,7 +210,7 @@
// Increase the amount to free so that allocate won't have to run right
// away again
- toFree += (cacheMaxSize / 20);
+ toFree += (cacheMaxSize / 16);
int size = notFoundCache.size();
if (size > spareNotFoundEntries) {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2012-01-05 16:10:52 UTC (rev 1913)
+++ trunk/webapps/docs/changelog.xml 2012-01-06 10:24:41 UTC (rev 1914)
@@ -22,6 +22,9 @@
<fix>
Updates for Servlet 3.0a. (markt, remm)
</fix>
+ <fix>
+ Fix cache defaults with low memory mode. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
Show replies by date