coderzc commented on code in PR #17092:
URL: https://github.com/apache/pulsar/pull/17092#discussion_r945464620


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -111,8 +111,10 @@ public boolean addMessage(long ledgerId, long entryId, 
long deliverAt) {
         }
 
 
-        priorityQueue.add(deliverAt, ledgerId, entryId);
-        updateTimer();
+        synchronized (this) {

Review Comment:
   > what do you think add synchronized to 
InMemoryDelayedDeliveryTracker#addMessage.
   
   Yes, I think can add `synchronized` to 
InMemoryDelayedDeliveryTracker#addMessage or add `synchronized` to 
   `PersistentDispatcherMultipleConsumers`.
   
   > i have a question: InMemoryDelayedDeliveryTracker#getScheduledMessages is 
also need a synchronized ?
   
   I think`getScheduledMessages` already add `synchronized` on 
`PersistentDispatcherMultipleConsumers #getMessagesToReplayNow`:
   
https://github.com/apache/pulsar/blob/825b68db7bed1c79af4b7b69b48bee76ebe75af5/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java#L446-L457



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to