Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Fix sending lag caused by thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
315157973 committed Dec 28, 2023
1 parent aa2f171 commit d52bf75
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -108,7 +110,7 @@ private static class PendingProduceCallback implements Runnable {
final CompletableFuture<Map<TopicPartition, ProduceResponse.PartitionResponse>> completableFuture;
Map<TopicPartition, MemoryRecords> entriesPerPartition;
@Override
public void run() {
public synchronized void run() {
topicPartitionNum.set(0);
if (completableFuture.isDone()) {
// It may be triggered again in DelayedProduceAndFetch
Expand Down

0 comments on commit d52bf75

Please sign in to comment.