kusalk commented on code in PR #1236:
URL: https://github.com/apache/struts/pull/1236#discussion_r2798315485
##########
core/src/main/java/org/apache/struts2/util/ProxyUtil.java:
##########
@@ -65,15 +66,18 @@ public class ProxyUtil {
* object as fallback; never {@code null})
*/
public static Class<?> ultimateTargetClass(Object candidate) {
- Class<?> result = null;
- if (isSpringAopProxy(candidate))
- result = springUltimateTargetClass(candidate);
-
- if (result == null) {
- result = candidate.getClass();
- }
-
- return result;
+ return targetClassCache.computeIfAbsent(candidate, k -> {
Review Comment:
Ah yes, good point.
One other suggestion I can make is to write some code to set the
memory-heavy references on the Action class to null after the request has
completed or neared completion. This will allow those objects to be garbage
collected even when the cache is holding a reference to the original Action
instance.
Otherwise, you can also consider building a custom/forked Struts JAR from
source until a new release is made available.
##########
core/src/main/java/org/apache/struts2/util/ProxyUtil.java:
##########
@@ -65,15 +66,18 @@ public class ProxyUtil {
* object as fallback; never {@code null})
*/
public static Class<?> ultimateTargetClass(Object candidate) {
- Class<?> result = null;
- if (isSpringAopProxy(candidate))
- result = springUltimateTargetClass(candidate);
-
- if (result == null) {
- result = candidate.getClass();
- }
-
- return result;
+ return targetClassCache.computeIfAbsent(candidate, k -> {
Review Comment:
Ah yes, good point.
One other suggestion I can make is to write some code to set the
memory-heavy references on the Action instance to null after the request has
completed or neared completion. This will allow those objects to be garbage
collected even when the cache is holding a reference to the original Action
instance.
Otherwise, you can also consider building a custom/forked Struts JAR from
source until a new release is made available.
--
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]