You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2020/11/19 21:54:13 UTC

[GitHub] [samza] prateekm commented on a change in pull request #1437: SAMZA-2598:Kafka clients are not created and closed properly

prateekm commented on a change in pull request #1437:
URL: https://github.com/apache/samza/pull/1437#discussion_r527227011



##########
File path: samza-core/src/main/java/org/apache/samza/coordinator/metadatastore/CoordinatorStreamStore.java
##########
@@ -111,6 +111,10 @@ public void init() {
       systemConsumer.start();
       systemProducer.register(SOURCE);
       systemProducer.start();
+      Runtime.getRuntime().addShutdownHook(new Thread(() -> {

Review comment:
       Relying on shutdown hooks for lifecycle management of components is not a good idea. 
   
   The close should be called by whoever created the SystemProducer etc instead. If it's created in this class, this class should have lifecycle methods of it's own, which should be called by the owner of this class.




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