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

dongjoon-hyun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new d202306  [SPARK-57969] Use virtual thread for periodic GC scheduler
d202306 is described below

commit d2023062171d6f2163cdfd92343fe43a4bdeabfc
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Mon Jul 6 12:08:44 2026 -0700

    [SPARK-57969] Use virtual thread for periodic GC scheduler
    
    ### What changes were proposed in this pull request?
    
    This PR aims to use a virtual thread factory for the periodic GC scheduler 
thread in `SparkOperator`.
    
    ### Why are the changes needed?
    
    The scheduled task (`SparkOperator::runSystemGc`) is short and periodic, 
which is an ideal fit for a virtual thread. Virtual threads are always daemon 
threads, so the existing daemon semantics are preserved.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Fable 5
    
    Closes #748 from dongjoon-hyun/SPARK-57969.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../src/main/java/org/apache/spark/k8s/operator/SparkOperator.java  | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/SparkOperator.java 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/SparkOperator.java
index 911117a..fb3c7f2 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/SparkOperator.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/SparkOperator.java
@@ -124,11 +124,7 @@ public class SparkOperator {
     if (periodicGcIntervalSeconds > 0L) {
       this.periodicGcScheduler =
           Executors.newSingleThreadScheduledExecutor(
-              r -> {
-                Thread t = new Thread(r, "spark-operator-periodic-gc");
-                t.setDaemon(true);
-                return t;
-              });
+              Thread.ofVirtual().name("periodic-gc").factory());
       this.periodicGcScheduler.scheduleAtFixedRate(
           SparkOperator::runSystemGc,
           periodicGcIntervalSeconds,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to