mjsax commented on a change in pull request #11370:
URL: https://github.com/apache/kafka/pull/11370#discussion_r722840836



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryKeyValueStore.java
##########
@@ -98,9 +96,15 @@ public synchronized void put(final Bytes key, final byte[] 
value) {
     }
 
     @Override
-    public void putAll(final List<KeyValue<Bytes, byte[]>> entries) {
+    public synchronized void putAll(final List<KeyValue<Bytes, byte[]>> 
entries) {
         for (final KeyValue<Bytes, byte[]> entry : entries) {
-            put(entry.key, entry.value);
+            // intended to duplicate codes in #put, to avoid continuously 
lock/unlock cost

Review comment:
       We should not duplicate code, but instead extract an internal `private` 
helper method `putInternal` that can be called by `put` and `putAll`




-- 
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


Reply via email to