This is an automated email from the ASF dual-hosted git repository.

bharathkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e91dfeff SAMZA-2795: Set thread to daemon thread for operator 
executor service (#1690)
2e91dfeff is described below

commit 2e91dfeff642f75192f28be33071fcb9ce443bb4
Author: Bharath Kumarasubramanian <[email protected]>
AuthorDate: Wed Nov 8 10:27:55 2023 -0800

    SAMZA-2795: Set thread to daemon thread for operator executor service 
(#1690)
    
    Description
    As part of SAMZA-2781, we introduced operator executors to manage operator 
handoff execution. However, the threads created by the executor service are 
non-daemon and hence prevent the JVM from shutting down.
    
    For context, we don't have a clean way to shutdown the executor due to lack 
of clean lifecycle management of the factory. Hence shutting down the executor 
service within TaskInstance is not an option and the fix is to make it daemon 
threads.
    
    Changes
    Make the threads spawned by the operator executor to be non-daemon
    
    Tests
    None
    
    API Changes
    None
    
    Upgrade Instructions
    None
    
    Usage Instructions
    None
---
 .../main/java/org/apache/samza/task/DefaultTaskExecutorFactory.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/samza-core/src/main/java/org/apache/samza/task/DefaultTaskExecutorFactory.java
 
b/samza-core/src/main/java/org/apache/samza/task/DefaultTaskExecutorFactory.java
index 5ed5165c1..5ea0fb317 100644
--- 
a/samza-core/src/main/java/org/apache/samza/task/DefaultTaskExecutorFactory.java
+++ 
b/samza-core/src/main/java/org/apache/samza/task/DefaultTaskExecutorFactory.java
@@ -68,7 +68,9 @@ public class DefaultTaskExecutorFactory implements 
TaskExecutorFactory {
       } else {
         LOG.info("Using single threaded thread pool as operator thread pool 
for task {}", key.getTaskName());
         operatorExecutor = Executors.newSingleThreadExecutor(
-            new ThreadFactoryBuilder().setNameFormat("Samza " + 
key.getTaskName() + " Thread-%d").build());
+            new ThreadFactoryBuilder().setNameFormat("Samza " + 
key.getTaskName() + " Thread-%d")
+                .setDaemon(true)
+                .build());
       }
 
       return operatorExecutor;

Reply via email to