lhotari commented on code in PR #15132:
URL: https://github.com/apache/pulsar/pull/15132#discussion_r857160555
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -447,10 +442,12 @@ public void publishMessage(ByteBuf headersAndPayload,
PublishContext publishCont
public void updateSubscribeRateLimiter() {
SubscribeRate subscribeRate = this.getSubscribeRate();
- if (isSubscribeRateEnabled(subscribeRate)) {
- subscribeRateLimiter = Optional.of(subscribeRateLimiter.orElse(new
SubscribeRateLimiter(this)));
- } else {
- subscribeRateLimiter = Optional.empty();
+ synchronized (subscribeRateLimiter) {
Review Comment:
remove `synchronized (subscribeRateLimiter) {`. That is invalid as I
explained previously. Making the field subscribeRateLimiter volatile is the
correct solution.
--
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]