You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/16 10:04:50 UTC

[GitHub] [pulsar] massakam commented on a change in pull request #10279: [PIP 79][client] Add lazy-loading feature to PartitionedProducer

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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org