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



##########
File path: streams/src/main/java/org/apache/kafka/streams/kstream/KStream.java
##########
@@ -2770,6 +2778,9 @@ void to(final TopicNameExtractor<K, V> topicExtractor,
      * To ensure type-safety at compile-time, {@link 
ProcessorContext#forward(Object, Object) context#forward()} should
      * not be used in {@link Transformer#transform(Object, Object) 
Transformer#transform()} and
      * {@link org.apache.kafka.streams.processor.Punctuator#punctuate(long) 
Punctuator#punctuate()}.
+     * The supplier should always generate a new instance each time invoking 
{@link TransformerSupplier#get()}. Creating
+     * a single Transformer object and returning the same object reference in 
{@link TransformerSupplier#get()} would be
+     * a violation of the supplier pattern and leads to runtime exceptions.
      *
      * @param transformerSupplier an instance of {@link TransformerSupplier} 
that generates a {@link Transformer}

Review comment:
       ```suggestion
        * @param transformerSupplier an instance of {@link TransformerSupplier} 
that generates a newly constructed {@link Transformer}
   ```




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


Reply via email to