Skip to content

Commit

Permalink
Intern MBean names used in cache
Browse files Browse the repository at this point in the history
Use string interning when creating the "matchName" used
in the caching data structure, in order to reuse
previously created String objects and to avoid
duplication of Strings with identical contents in memory.
  • Loading branch information
yana-ilieva committed Dec 13, 2024
1 parent 714cd96 commit b157a43
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public void recordBean(
attributeName = attrName;
}

String matchName = beanName + attributeName + ": " + matchBeanValue;
String matchName = (beanName + attributeName + ": " + matchBeanValue).intern();

if (rule.cache) {
MatchedRule cachedRule = config.rulesCache.get(rule, matchName);
Expand Down

0 comments on commit b157a43

Please sign in to comment.