diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java index ec19708948619..7ff6f3194a02f 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/ConsistentHashingTopicBundleAssigner.java @@ -28,8 +28,6 @@ public class ConsistentHashingTopicBundleAssigner implements TopicBundleAssignmentStrategy { private PulsarService pulsar; - private volatile HashFunction hashFunction; - @Override public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespaceBundles) { NamespaceBundle bundle = namespaceBundles.getBundle(calculateBundleHashCode(topicName)); @@ -41,10 +39,7 @@ public NamespaceBundle findBundle(TopicName topicName, NamespaceBundles namespac @Override public long calculateBundleHashCode(TopicName topicName) { - if (hashFunction == null) { - hashFunction = getBundleHashFunc(); - } - return hashFunction.hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); + return getBundleHashFunc().hashString(topicName.toString(), StandardCharsets.UTF_8).padToLong(); } @Override