From 795f7331e27602fb2579d2aa12f048d546fc4de6 Mon Sep 17 00:00:00 2001 From: lambdaliu Date: Fri, 15 Feb 2019 01:48:44 +0800 Subject: [PATCH] KAFKA-7811: Avoid unnecessary lock acquire when KafkaConsumer commits offsets (#6119) Avoid unnecessary lock acquire when KafkaConsumer commits offsets. Reviewers: Viktor Somogyi-Vass , Guozhang Wang --- .../org/apache/kafka/clients/consumer/KafkaConsumer.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java index b1d407ee4dc..772f973bc58 100644 --- a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java +++ b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java @@ -1459,12 +1459,7 @@ public class KafkaConsumer implements Consumer { */ @Override public void commitAsync(OffsetCommitCallback callback) { - acquireAndEnsureOpen(); - try { - commitAsync(subscriptions.allConsumed(), callback); - } finally { - release(); - } + commitAsync(subscriptions.allConsumed(), callback); } /**