Skip to content

Commit

Permalink
Clear the MDC in the Kafka plugin thread.
Browse files Browse the repository at this point in the history
Signed-off-by: David Venable <[email protected]>
  • Loading branch information
dlvenable committed Feb 15, 2024
1 parent d5e8095 commit 58d9a7d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public static KafkaPluginThreadFactory defaultExecutorThreadFactory(final String
public Thread newThread(final Runnable runnable) {
final Thread thread = delegateThreadFactory.newThread(() -> {
MDC.put(KafkaMdc.MDC_KAFKA_PLUGIN_KEY, kafkaPluginType);
runnable.run();
try {
runnable.run();
} finally {
MDC.clear();
}
});

thread.setName(threadPrefix + threadNumber.getAndIncrement());
Expand Down

0 comments on commit 58d9a7d

Please sign in to comment.