jshmchenxi opened a new pull request, #47945:
URL: https://github.com/apache/spark/pull/47945

   backport #44701 and #44718 to 3.5 branch as a fix for 
[SPARK-49479](https://issues.apache.org/jira/browse/SPARK-49479):
   Non-daemon Timer prevents Spark driver JVM from stopping.
    
   ### What changes were proposed in this pull request?
   This PR propose to replace `Timer` with single thread scheduled executor.
   
   ### Why are the changes needed?
   The javadoc recommends `ScheduledThreadPoolExecutor` instead of `Timer`.
   ![屏幕快照 2024-01-12 下午12 47 
57](https://github.com/apache/spark/assets/8486025/4fc5ed61-6bb9-4768-915a-ad919a067d04)
   
   This change based on the following two points.
   **System time sensitivity**
   
   Timer scheduling is based on the absolute time of the operating system and 
is sensitive to the operating system's time. Once the operating system's time 
changes, Timer scheduling is no longer precise.
   The scheduled Thread Pool Executor scheduling is based on relative time and 
is not affected by changes in operating system time.
   
   **Are anomalies captured**
   
   Timer does not capture exceptions thrown by Timer Tasks, and in addition, 
Timer is single threaded. Once a scheduling task encounters an exception, the 
entire thread will terminate and other tasks that need to be scheduled will no 
longer be executed.
   The scheduled Thread Pool Executor implements scheduling functions based on 
a thread pool. After a task throws an exception, other tasks can still execute 
normally.
   
   ### Does this PR introduce _any_ user-facing change?
   'No'.
   
   ### How was this patch tested?
   GA tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   'No'.
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to