Browse Source

KAFKA-7811: Avoid unnecessary lock acquire when KafkaConsumer commits offsets (#6119)

Avoid unnecessary lock acquire when KafkaConsumer commits offsets.

Reviewers: Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Guozhang Wang <wangguoz@gmail.com>
pull/6271/head
lambdaliu 6 years ago committed by Guozhang Wang
parent
commit
795f7331e2
  1. 7
      clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java

7
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java

@ -1459,12 +1459,7 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
*/ */
@Override @Override
public void commitAsync(OffsetCommitCallback callback) { public void commitAsync(OffsetCommitCallback callback) {
acquireAndEnsureOpen(); commitAsync(subscriptions.allConsumed(), callback);
try {
commitAsync(subscriptions.allConsumed(), callback);
} finally {
release();
}
} }
/** /**

Loading…
Cancel
Save