Skip to content

Commit 536fd4f

Browse files
committed
Alright, let's cache 'em
1 parent eec5e1e commit 536fd4f

File tree

1 file changed

+3
-1
lines changed
  • libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy

1 file changed

+3
-1
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ public <E extends Entitlement> Stream<E> getEntitlements(Class<E> entitlementCla
100100
}
101101

102102
public Logger logger() {
103-
return LogManager.getLogger(loggerName);
103+
return MODULE_LOGGERS.computeIfAbsent(loggerName, LogManager::getLogger);
104104
}
105105
}
106106

107+
private static final ConcurrentHashMap<String, Logger> MODULE_LOGGERS = new ConcurrentHashMap<>();
108+
107109
private FileAccessTree getDefaultFileAccess(String componentName, Path componentPath) {
108110
return FileAccessTree.of(componentName, UNKNOWN_COMPONENT_NAME, FilesEntitlement.EMPTY, pathLookup, componentPath, List.of());
109111
}

0 commit comments

Comments
 (0)