This is an automated email from the ASF dual-hosted git repository.
sarutak pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new e1eed92c6bc3 [SPARK-57891][CORE][DOC][FOLLOWUP] Fix contradictory
thread-safety docs in `CredentialProviderLoader`
e1eed92c6bc3 is described below
commit e1eed92c6bc382ed8e0f6e6b7d4e785fad3296cf
Author: Anupam Yadav <[email protected]>
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 <[email protected]>
Signed-off-by: Kousuke Saruta <[email protected]>
(cherry picked from commit cd7f2803d1f190175d14e40b476c9ce9be4b39b9)
Signed-off-by: Kousuke Saruta <[email protected]>
---
.../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: [email protected]
For additional commands, e-mail: [email protected]