Skip to content

Commit

Permalink
[improve][broker] Improve the extensibility of the TopicBundleAssignm…
Browse files Browse the repository at this point in the history
…entStrategy interface class (#23773)
  • Loading branch information
rayluoluo committed Jan 10, 2025
1 parent b8efc53 commit 04423ba
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down

0 comments on commit 04423ba

Please sign in to comment.