From a7628e8aade9e41bce31027731578adc202769cb Mon Sep 17 00:00:00 2001 From: coderzc Date: Tue, 20 Dec 2022 11:32:22 +0800 Subject: [PATCH] add synchronized for recoverBucketSnapshot --- .../broker/delayed/bucket/BucketDelayedDeliveryTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java index 773f3944fbcd7..b402b51ce071c 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java @@ -103,7 +103,7 @@ public BucketDelayedDeliveryTracker(PersistentDispatcherMultipleConsumers dispat this.numberDelayedMessages = recoverBucketSnapshot(); } - private long recoverBucketSnapshot() throws RuntimeException { + private synchronized long recoverBucketSnapshot() throws RuntimeException { ManagedCursor cursor = this.lastMutableBucket.cursor; cursor.getCursorProperties().keySet().forEach(key -> { if (key.startsWith(DELAYED_BUCKET_KEY_PREFIX)) {