You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sa...@apache.org on 2026/07/14 23:13:26 UTC

(spark) branch master updated: [SPARK-57891][CORE][DOC][FOLLOWUP] Fix contradictory thread-safety docs in `CredentialProviderLoader`

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

sarutak 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 cd7f2803d1f1 [SPARK-57891][CORE][DOC][FOLLOWUP] Fix contradictory thread-safety docs in `CredentialProviderLoader`
cd7f2803d1f1 is described below

commit cd7f2803d1f190175d14e40b476c9ce9be4b39b9
Author: Anupam Yadav <an...@gmail.com>
AuthorDate: Wed Jul 15 08:13:15 2026 +0900

    [SPARK-57891][CORE][DOC][FOLLOWUP] Fix contradictory thread-safety docs in `CredentialProviderLoader`
    
    ### What changes were proposed in this pull request?
    
    Follow-up to [SPARK-57891](https://issues.apache.org/jira/browse/SPARK-57891) (#57191). A review comment on the merged PR pointed out a contradiction in the thread-safety documentation:
    
    - `CredentialProvider` says: *"Implementations must be thread-safe: `resolve()` may be called concurrently from multiple threads after `init()` completes."*
    - `CredentialProviderLoader` said: *"the returned `CredentialProvider` instances are not guaranteed to be thread-safe; callers should synchronize on the provider or confine it to a single thread."*
    
    These conflict. The intended contract is thread-safe-required: `CredentialProviderLoader` caches and shares a single provider instance across callers, and `resolve()` may be invoked concurrently (e.g., credential refresh), so implementations must be thread-safe. This corrects the `CredentialProviderLoader` Javadoc to state that a returned (shared) instance may be used concurrently per the `CredentialProvider` contract, while keeping the note that the loader itself synchronizes its cac [...]
    
    ### Why are the changes needed?
    
    To remove the contradictory guidance so the SPI's thread-safety contract is unambiguous for provider implementers.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. Documentation-only change; no behavior change.
    
    ### How was this patch tested?
    
    Documentation-only. `core` compiles and `dev/lint-java` (checkstyle) passes.
    Also double-checked other javadocs to make sure they're consistent with the changes in #57191
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #57252 from yadavay-amzn/SPARK-57891-followup.
    
    Authored-by: Anupam Yadav <an...@gmail.com>
    Signed-off-by: Kousuke Saruta <sa...@apache.org>
---
 .../java/org/apache/spark/security/CredentialProviderLoader.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/spark/security/CredentialProviderLoader.java b/core/src/main/java/org/apache/spark/security/CredentialProviderLoader.java
index af2b9252698b..f5c36614b61f 100644
--- a/core/src/main/java/org/apache/spark/security/CredentialProviderLoader.java
+++ b/core/src/main/java/org/apache/spark/security/CredentialProviderLoader.java
@@ -51,9 +51,10 @@ import org.apache.spark.annotation.Private;
  * multiple candidates produce an ambiguity error; no candidates produce {@code Optional.empty()}.
  * <p>
  * <b>Thread-safety:</b> This class uses synchronized access to the cached provider list and
- * initialization tracking. Callers may invoke {@link #providerFor(String, Map)} from multiple
- * threads. However, the returned {@link CredentialProvider} instances are not guaranteed to be
- * thread-safe; callers should synchronize on the provider or confine it to a single thread.
+ * initialization tracking, and callers may invoke {@link #providerFor(String, Map)} from
+ * multiple threads. A provider instance is cached and shared across callers; per the
+ * {@link CredentialProvider} contract, implementations must be thread-safe, so a returned
+ * instance may be used concurrently.
  *
  * @since 4.3.0
  */


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org