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 2020/08/06 09:53:20 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #7764: Allow the option to make producers thread local

sijie commented on a change in pull request #7764:
URL: https://github.com/apache/pulsar/pull/7764#discussion_r466299090



##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ContextImpl.java
##########
@@ -102,19 +103,25 @@ public ContextImpl(InstanceConfig config, Logger logger, PulsarClient client,
         this.config = config;
         this.logger = logger;
         this.client = client;
-        this.publishProducers = new HashMap<>();
         this.topicSchema = new TopicSchema(client);
         this.statsManager = statsManager;
 
         this.producerBuilder = (ProducerBuilderImpl<?>) client.newProducer().blockIfQueueFull(true).enableBatching(true)
                 .batchingMaxPublishDelay(1, TimeUnit.MILLISECONDS);
+        boolean useThreadLocalProducers = false;
         if (config.getFunctionDetails().getSink().getProducerSpec() != null) {
             if (config.getFunctionDetails().getSink().getProducerSpec().getMaxPendingMessages() != 0) {
                 this.producerBuilder.maxPendingMessages(config.getFunctionDetails().getSink().getProducerSpec().getMaxPendingMessages());
             }
             if (config.getFunctionDetails().getSink().getProducerSpec().getMaxPendingMessagesAcrossPartitions() != 0) {
                 this.producerBuilder.maxPendingMessagesAcrossPartitions(config.getFunctionDetails().getSink().getProducerSpec().getMaxPendingMessagesAcrossPartitions());
             }
+            useThreadLocalProducers = config.getFunctionDetails().getSink().getProducerSpec().getUseThreadLocalProducers();

Review comment:
       This would cause a NullPointerException if `useThreadLocalProducers` is not set.




----------------------------------------------------------------
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:
users@infra.apache.org