Author: markt Date: Fri Dec 27 14:38:46 2013 New Revision: 1553679 URL: http://svn.apache.org/r1553679 Log: Align names between 7.0.x and 8.0.x
Modified: tomcat/trunk/java/org/apache/catalina/WebResourceRoot.java tomcat/trunk/java/org/apache/catalina/core/StandardContext.java tomcat/trunk/java/org/apache/catalina/webresources/Cache.java tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java tomcat/trunk/java/org/apache/catalina/webresources/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java tomcat/trunk/test/org/apache/catalina/webresources/TesterWebResourceRoot.java Modified: tomcat/trunk/java/org/apache/catalina/WebResourceRoot.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/WebResourceRoot.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/WebResourceRoot.java (original) +++ tomcat/trunk/java/org/apache/catalina/WebResourceRoot.java Fri Dec 27 14:38:46 2013 @@ -349,10 +349,10 @@ public interface WebResourceRoot extends * Set the maximum permitted size for a single object in the cache. Note * that the maximum size in bytes may not exceed {@link Integer#MAX_VALUE}. * - * @param cacheMaxObjectSize Maximum size for a single cached object in + * @param cacheObjectMaxSize Maximum size for a single cached object in * kilobytes */ - void setCacheMaxObjectSize(int cacheMaxObjectSize); + void setCacheObjectMaxSize(int cacheObjectMaxSize); /** * Get the maximum permitted size for a single object in the cache. Note @@ -360,7 +360,7 @@ public interface WebResourceRoot extends * * @return Maximum size for a single cached object in kilobytes */ - int getCacheMaxObjectSize(); + int getCacheObjectMaxSize(); /** * Controls whether the trace locked files feature is enabled. If enabled, Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Dec 27 14:38:46 2013 @@ -4912,7 +4912,7 @@ public class StandardContext extends Con resources.setCachingAllowed(isCachingAllowed()); resources.setCacheTtl(getCacheTTL()); resources.setCacheMaxSize(getCacheMaxSize()); - resources.setCacheMaxObjectSize(getCacheObjectMaxSize()); + resources.setCacheObjectMaxSize(getCacheObjectMaxSize()); // May have been started (but not fully configured) in init() so no need // to start the resources if they are already available Modified: tomcat/trunk/java/org/apache/catalina/webresources/Cache.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/Cache.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/webresources/Cache.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/Cache.java Fri Dec 27 14:38:46 2013 @@ -42,7 +42,7 @@ public class Cache { private long ttl = 5000; private long maxSize = 10 * 1024 * 1024; - private int maxObjectSize = + private int objectMaxSize = (int) (maxSize / 20 > Integer.MAX_VALUE ? Integer.MAX_VALUE : maxSize / 20); private AtomicLong lookupCount = new AtomicLong(0); @@ -72,9 +72,9 @@ public class Cache { if (cacheEntry == null) { // Local copy to ensure consistency - int maxObjectSizeBytes = getMaxObjectSizeBytes(); + int objectMaxSizeBytes = getObjectMaxSizeBytes(); CachedResource newCacheEntry = - new CachedResource(root, path, getTtl(), maxObjectSizeBytes); + new CachedResource(root, path, getTtl(), objectMaxSizeBytes); // Concurrent callers will end up with the same CachedResource // instance @@ -211,23 +211,22 @@ public class Cache { return hitCount.get(); } - public void setMaxObjectSize(int maxObjectSize) { - if (maxObjectSize * 1024L > Integer.MAX_VALUE) { - log.warn(sm.getString("cache.maxObjectSizeTooBig", - Integer.valueOf(maxObjectSize))); - this.maxObjectSize = Integer.MAX_VALUE; + public void setObjectMaxSize(int objectMaxSize) { + if (objectMaxSize * 1024L > Integer.MAX_VALUE) { + log.warn(sm.getString("cache.objectMaxSizeTooBig", Integer.valueOf(objectMaxSize))); + this.objectMaxSize = Integer.MAX_VALUE; } // Internally bytes, externally kilobytes - this.maxObjectSize = maxObjectSize * 1024; + this.objectMaxSize = objectMaxSize * 1024; } - public int getMaxObjectSize() { + public int getObjectMaxSize() { // Internally bytes, externally kilobytes - return maxObjectSize / 1024; + return objectMaxSize / 1024; } - public int getMaxObjectSizeBytes() { - return maxObjectSize; + public int getObjectMaxSizeBytes() { + return objectMaxSize; } public void clear() { Modified: tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java Fri Dec 27 14:38:46 2013 @@ -39,7 +39,7 @@ public class CachedResource implements W private final StandardRoot root; private final String webAppPath; private final long ttl; - private final int maxObjectSizeBytes; + private final int objectMaxSizeBytes; private volatile WebResource webResource; private volatile long nextCheck; @@ -55,11 +55,11 @@ public class CachedResource implements W public CachedResource(StandardRoot root, String path, long ttl, - int maxObjectSizeBytes) { + int objectMaxSizeBytes) { this.root = root; this.webAppPath = path; this.ttl = ttl; - this.maxObjectSizeBytes = maxObjectSizeBytes; + this.objectMaxSizeBytes = objectMaxSizeBytes; } protected boolean validate(boolean useClassLoaderResources) { @@ -239,7 +239,7 @@ public class CachedResource implements W public byte[] getContent() { byte[] cachedContent = this.cachedContent; if (cachedContent == null) { - if (getContentLength() > maxObjectSizeBytes) { + if (getContentLength() > objectMaxSizeBytes) { return null; } cachedContent = webResource.getContent(); @@ -282,7 +282,7 @@ public class CachedResource implements W // case but it makes tracking the current cache size easier. long getSize() { long result = CACHE_ENTRY_SIZE; - if (getContentLength() <= maxObjectSizeBytes) { + if (getContentLength() <= objectMaxSizeBytes) { result += getContentLength(); } return result; Modified: tomcat/trunk/java/org/apache/catalina/webresources/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/LocalStrings.properties?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/webresources/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/LocalStrings.properties Fri Dec 27 14:38:46 2013 @@ -18,7 +18,7 @@ abstractResource.getContentTooLarge=Unab cache.addFail=Unable to add the resource at [{0}] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache cache.backgroundEvictFail=The background cache eviction process was unable to free [{0}] percent of the cache for Context [{1}] - consider increasing the maximum size of the cache. After eviction approximately [{2}] KB of data remained in the cache. -cache.maxObjectSizeTooBig=The value specified for the maximum object size to cache [{0}]kB is greater than Integer.MAX_VALUE bytes which is the maximum size that can be cached. The limit will be set to Integer.MAX_VALUE bytes. +cache.objectMaxSizeTooBig=The value specified for the maximum object size to cache [{0}]kB is greater than Integer.MAX_VALUE bytes which is the maximum size that can be cached. The limit will be set to Integer.MAX_VALUE bytes. dirResourceSet.writeExists=The target of the write already exists dirResourceSet.writeNpe=The input stream may not be null Modified: tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java Fri Dec 27 14:38:46 2013 @@ -464,13 +464,13 @@ public class StandardRoot extends Lifecy } @Override - public void setCacheMaxObjectSize(int cacheMaxObjectSize) { - cache.setMaxObjectSize(cacheMaxObjectSize); + public void setCacheObjectMaxSize(int cacheObjectMaxSize) { + cache.setObjectMaxSize(cacheObjectMaxSize); } @Override - public int getCacheMaxObjectSize() { - return cache.getMaxObjectSize(); + public int getCacheObjectMaxSize() { + return cache.getObjectMaxSize(); } @Override Modified: tomcat/trunk/test/org/apache/catalina/webresources/TesterWebResourceRoot.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/webresources/TesterWebResourceRoot.java?rev=1553679&r1=1553678&r2=1553679&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/webresources/TesterWebResourceRoot.java (original) +++ tomcat/trunk/test/org/apache/catalina/webresources/TesterWebResourceRoot.java Fri Dec 27 14:38:46 2013 @@ -143,12 +143,12 @@ public class TesterWebResourceRoot exten } @Override - public void setCacheMaxObjectSize(int cacheMaxObjectSize) { + public void setCacheObjectMaxSize(int cacheObjectMaxSize) { // NO-OP } @Override - public int getCacheMaxObjectSize() { + public int getCacheObjectMaxSize() { return 0; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org