tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r828212 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Date Wed, 21 Oct 2009 20:57:14 GMT
Author: markt
Date: Wed Oct 21 20:57:14 2009
New Revision: 828212

URL: http://svn.apache.org/viewvc?rev=828212&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47987
Limit size of not found resources cache

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=828212&r1=828211&r2=828212&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Wed Oct 21 20:57:14
2009
@@ -41,6 +41,8 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Vector;
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
@@ -238,7 +240,14 @@
      * The cache of ResourceEntry for classes and resources we have loaded,
      * keyed by resource name.
      */
-    protected HashMap<String, ResourceEntry> resourceEntries = new HashMap<String,
ResourceEntry>();
+    protected HashMap<String, ResourceEntry> resourceEntries =
+            new LinkedHashMap<String, ResourceEntry>() {
+        private static final long serialVersionUID = 1L;
+        protected boolean removeEldestEntry(
+                Map.Entry<String, ResourceEntry> eldest) {
+            return size() > 1000;
+        }
+    };
 
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message