Skip to content

Commit

Permalink
Intern MBean names used in cache (#1098)
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.

Signed-off-by: Yana Ilieva <yana.ilieva987@gmail.com>
  • Loading branch information
yana-ilieva authored Dec 13, 2024
1 parent 1f6f6af commit 4354210
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 4354210

Please sign in to comment.