jiazhai commented on a change in pull request #4267: [Issue-4266][pulsar-flink] 
Flink Pulsar Producer should reused across threads
URL: https://github.com/apache/pulsar/pull/4267#discussion_r284511502
 
 

 ##########
 File path: 
pulsar-flink/src/main/java/org/apache/flink/batch/connectors/pulsar/BasePulsarOutputFormat.java
 ##########
 @@ -85,7 +90,8 @@ public void configure(Configuration configuration) {
 
     @Override
     public void open(int taskNumber, int numTasks) throws IOException {
-        this.producer = getProducerInstance();
+        producer = getProducerInstance();
+        producerRefCnt.incrementAndGet();
 
 Review comment:
   How about move this ref change into the `synchronized` block of 
`getProducerInstance`? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to