mimaison commented on code in PR #15705: URL: https://github.com/apache/kafka/pull/15705#discussion_r1565721043
########## clients/src/main/java/org/apache/kafka/common/utils/BufferSupplier.java: ########## @@ -79,12 +79,8 @@ public ByteBuffer get(int size) { @Override public void release(ByteBuffer buffer) { buffer.clear(); - Deque<ByteBuffer> bufferQueue = bufferMap.get(buffer.capacity()); - if (bufferQueue == null) { - // We currently keep a single buffer in flight, so optimise for that case - bufferQueue = new ArrayDeque<>(1); - bufferMap.put(buffer.capacity(), bufferQueue); - } + Deque<ByteBuffer> bufferQueue = bufferMap.computeIfAbsent(buffer.capacity(), k -> new ArrayDeque<>(1)); + // We currently keep a single buffer in flight, so optimise for that case Review Comment: Good point! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org