From adad1fb84200f3e6858cea453a7ce6f13ef93de2 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Wed, 22 May 2024 05:56:14 +0300 Subject: [PATCH] [improve][broker] Clear thread local BrokerEntryMetadata instance before reuse (#22752) --- .../main/java/org/apache/pulsar/common/protocol/Commands.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java b/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java index 65674af0ae14e..8599ec2dd3475 100644 --- a/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java +++ b/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java @@ -1705,6 +1705,7 @@ public static ByteBuf addBrokerEntryMetadata(ByteBuf headerAndPayload, // | 2 bytes | 4 bytes | BROKER_ENTRY_METADATA_SIZE bytes | BrokerEntryMetadata brokerEntryMetadata = BROKER_ENTRY_METADATA.get(); + brokerEntryMetadata.clear(); for (BrokerEntryMetadataInterceptor interceptor : brokerInterceptors) { interceptor.intercept(brokerEntryMetadata); if (numberOfMessages >= 0) {