merlimat commented on code in PR #23052:
URL: https://github.com/apache/pulsar/pull/23052#discussion_r1683904834
##########
pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java:
##########
@@ -79,11 +78,9 @@ public static TopicName get(String domain, String tenant,
String cluster, String
}
public static TopicName get(String topic) {
- try {
- return cache.get(topic);
- } catch (ExecutionException | UncheckedExecutionException e) {
- throw (RuntimeException) e.getCause();
- }
+ return cache.computeIfAbsent(topic, k -> {
+ return new TopicName(k);
+ });
Review Comment:
```suggestion
return cache.computeIfAbsent(topic, k -> new TopicName(k));
```
##########
conf/broker.conf:
##########
@@ -159,6 +159,13 @@ skipBrokerShutdownOnOOM=false
# Factory class-name to create topic with custom workflow
topicFactoryClassName=
+# Max capacity of the topic name cache. 0 means unlimited cache.
+topicNameCacheCaxCapacity=100000
+
+# A Specifies the minimum number of minutes that the system stays in the
memory, to avoid clear cache frequently when
Review Comment:
```suggestion
# A Specifies the minimum number of seconds that the topic name stays in
memory, to avoid clear cache frequently when
```
--
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]