remm 2003/07/30 11:35:51 Modified: catalina/src/share/org/apache/naming/resources BaseDirContext.java ProxyDirContext.java Log: - Add code allowing configuring the resource cache size. - Code cleanup. Revision Changes Path 1.2 +11 -11 jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/BaseDirContext.java Index: BaseDirContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/BaseDirContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BaseDirContext.java 18 Jul 2002 16:47:32 -0000 1.1 +++ BaseDirContext.java 30 Jul 2003 18:35:50 -0000 1.2 @@ -161,7 +161,7 @@ /** * Max size of resources which will have their content cached. */ - protected int cacheObjectMaxSize = 32768; // 32 KB + protected int cacheMaxSize = 10240; // 10 MB // ------------------------------------------------------------- Properties @@ -249,18 +249,18 @@ /** - * Set cacheObjectMaxSize. + * Return the maximum size of the cache in KB. */ - public void setCacheObjectMaxSize(int cacheObjectMaxSize) { - this.cacheObjectMaxSize = cacheObjectMaxSize; + public int getCacheMaxSize() { + return cacheMaxSize; } /** - * Get cacheObjectMaxSize. + * Set the maximum size of the cache in KB. */ - public int getCacheObjectMaxSize() { - return cacheObjectMaxSize; + public void setCacheMaxSize(int cacheMaxSize) { + this.cacheMaxSize = cacheMaxSize; } 1.12 +9 -8 jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/ProxyDirContext.java Index: ProxyDirContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/ProxyDirContext.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ProxyDirContext.java 12 Jun 2003 22:03:34 -0000 1.11 +++ ProxyDirContext.java 30 Jul 2003 18:35:50 -0000 1.12 @@ -115,7 +115,8 @@ if (dirContext instanceof BaseDirContext) { // Initialize parameters based on the associated dir context, like // the caching policy. - if (((BaseDirContext) dirContext).isCached()) { + BaseDirContext baseDirContext = (BaseDirContext) dirContext; + if (baseDirContext.isCached()) { try { cache = (ResourceCache) Class.forName(cacheClassName).newInstance(); @@ -123,9 +124,9 @@ //FIXME e.printStackTrace(); } - cacheTTL = ((BaseDirContext) dirContext).getCacheTTL(); - cacheObjectMaxSize = - ((BaseDirContext) dirContext).getCacheObjectMaxSize(); + cache.setCacheMaxSize(baseDirContext.getCacheMaxSize()); + cacheTTL = baseDirContext.getCacheTTL(); + cacheObjectMaxSize = baseDirContext.getCacheMaxSize() / 20; } } hostName = (String) env.get(HOST);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]