Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ public int partition(String topic, Object key, byte[] keyBytes, Object value, by
}

private int nextValue(String topic) {
AtomicInteger counter = topicCounterMap.computeIfAbsent(topic, k -> new AtomicInteger(0));
AtomicInteger counter = topicCounterMap.get(topic);
if(counter == null) {
counter = new AtomicInteger(0);
AtomicInteger counter = topicCounterMap.putIfAbsent(topic, counter);
}
return counter.getAndIncrement();
}

Expand Down