You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/07/03 18:13:29 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #8978: KAFKA-10234 The key/value deserializer used by ConsoleConsumer is not…

chia7712 commented on a change in pull request #8978:
URL: https://github.com/apache/kafka/pull/8978#discussion_r449675093



##########
File path: clients/src/test/java/org/apache/kafka/test/MockDeserializer.java
##########
@@ -26,17 +26,16 @@
 
 public class MockDeserializer implements ClusterResourceListener, Deserializer<byte[]> {
     public static AtomicInteger initCount = new AtomicInteger(0);
-    public static AtomicInteger closeCount = new AtomicInteger(0);
     public static AtomicReference<ClusterResource> clusterMeta = new AtomicReference<>();
     public static ClusterResource noClusterId = new ClusterResource("no_cluster_id");
     public static AtomicReference<ClusterResource> clusterIdBeforeDeserialize = new AtomicReference<>(noClusterId);
 
     public boolean isKey;
     public Map<String, ?> configs;
+    public boolean isClosed = false;

Review comment:
       I did not reuse the atomic count since the count is a static variable. Junit, by default, could run different tests on same JVM and hence the static variable may be changed by other tests.
   
   
   For another, your point makes sense that the atomic integer is good enough. I will revert the Boolean and remove the static modifier to prevent the case I described above.




----------------------------------------------------------------
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