lukaszlenart commented on code in PR #1721:
URL: https://github.com/apache/struts/pull/1721#discussion_r3401079174


##########
core/src/main/java/org/apache/struts2/util/ConfigParseUtil.java:
##########
@@ -33,6 +35,15 @@
 import static org.apache.commons.lang3.StringUtils.strip;
 
 public class ConfigParseUtil {
+    // Size the cache to prevent excessive memory usage in environments with 
many classloaders and/or large numbers of classes being validated.
+    // While still providing a reasonable caching benefit for common cases 
(e.g. multiple Struts instances in the same container, or multiple calls to 
validate the same class across different containers).
+    private static final int MAX_CLASS_CACHE_SIZE = 50;
+
+    private static final Cache<ClassLoader, Cache<String, Class<?>>> 
VALIDATED_CLASS_CACHE = Caffeine.newBuilder()
+            .weakKeys()
+            .weakValues()

Review Comment:
   @brianandle what about this one? Any comment?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to