massakam commented on a change in pull request #10279:
URL: https://github.com/apache/pulsar/pull/10279#discussion_r709974383



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java
##########
@@ -159,7 +170,14 @@ private void start() {
                 return null;
             });
         }
+    }
 
+    private ProducerImpl<T> createProducer(final int partitionIndex) {
+        String partitionName = 
TopicName.get(topic).getPartition(partitionIndex).toString();
+        ProducerImpl<T> producer = client.newProducerImpl(partitionName, 
partitionIndex,
+                conf, schema, interceptors, new CompletableFuture<>());
+        producers.put(partitionIndex, producer);

Review comment:
       Isn't it necessary to add an entry to `producers` using 
`computeIfAbsent`? I'm wondering if there will be a race condition with 
multiple threads.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to