You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "John Roesler (JIRA)" <ji...@apache.org> on 2018/09/07 16:37:00 UTC

[jira] [Created] (KAFKA-7386) Streams Scala wrapper should not cache serdes

John Roesler created KAFKA-7386:
-----------------------------------

             Summary: Streams Scala wrapper should not cache serdes
                 Key: KAFKA-7386
                 URL: https://issues.apache.org/jira/browse/KAFKA-7386
             Project: Kafka
          Issue Type: Bug
            Reporter: John Roesler
            Assignee: John Roesler


for example, [https://github.com/apache/kafka/blob/trunk/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/Serdes.scala#L28] invokes Serdes.String() once and caches the result.

However, the implementation of the String serde has a non-empty configure method that is variant in whether it's used as a key or value serde. So we won't get correct execution if we create one serde and use it for both keys and values.

The fix is simple: change all the `val` declarations in scala.Serdes to `def`. Thanks to the referential transparency for parameterless methods in scala, no user-facing code will break.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)