This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new de79388923ee [SPARK-46717][CORE] Simplify `ReloadingX509TrustManager` by the exit operation only depend on interrupt thread de79388923ee is described below commit de79388923eefa84617759e84ec4b19bd7984348 Author: beliefer <belie...@163.com> AuthorDate: Mon Jan 15 14:31:16 2024 -0800 [SPARK-46717][CORE] Simplify `ReloadingX509TrustManager` by the exit operation only depend on interrupt thread ### What changes were proposed in this pull request? This PR propose to simplify the `ReloadingX509TrustManager`. ### Why are the changes needed? Currently, close or destroy `ReloadingX509TrustManager` depend on interrupt thread and the volatile variable `running`. In fact, we can change the `running` to a local variable on stack and let the close operation of `ReloadingX509TrustManager` only depend on interrupt thread. ### 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'. Closes #44720 from beliefer/simplify-ReloadingX509TrustManager. Authored-by: beliefer <belie...@163.com> Signed-off-by: Dongjoon Hyun <dh...@apple.com> --- .../org/apache/spark/network/ssl/ReloadingX509TrustManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/network-common/src/main/java/org/apache/spark/network/ssl/ReloadingX509TrustManager.java b/common/network-common/src/main/java/org/apache/spark/network/ssl/ReloadingX509TrustManager.java index 6572506f38df..18618e7d5c8b 100644 --- a/common/network-common/src/main/java/org/apache/spark/network/ssl/ReloadingX509TrustManager.java +++ b/common/network-common/src/main/java/org/apache/spark/network/ssl/ReloadingX509TrustManager.java @@ -61,7 +61,6 @@ public final class ReloadingX509TrustManager protected volatile int needsReloadCheckCounts; private final AtomicReference<X509TrustManager> trustManagerRef; - private volatile boolean running; private Thread reloader; /** @@ -98,7 +97,6 @@ public final class ReloadingX509TrustManager public void init() { reloader = new Thread(this, "Truststore reloader thread"); reloader.setDaemon(true); - running = true; reloader.start(); } @@ -106,7 +104,6 @@ public final class ReloadingX509TrustManager * Stops the reloader thread. */ public void destroy() throws InterruptedException { - running = false; reloader.interrupt(); reloader.join(); } @@ -200,11 +197,12 @@ public final class ReloadingX509TrustManager @Override public void run() { + boolean running = true; while (running) { try { Thread.sleep(reloadInterval); } catch (InterruptedException e) { - //NOP + running = false; } try { if (running && needsReload()) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org