Skip to content

Conversation

@phipag
Copy link
Contributor

@phipag phipag commented Nov 12, 2025

Summary

This PR makes the Parameters utility including all providers thread-safe. This means, they can now safely be used from multi-threaded scenarios (e.g. parallel batch processing). The cache is also thread-safe and propagates across threads.

Changes

The core changes required are in the BaseProvider, CacheManger, and TransformationManager. Due to the fluent API using method chaining, methods such as .withMaxAge(...).get("key") led to two separate instructions which can cause race conditions in multi-threaded scenarios.

The solution used in this PR is to use ThreadLocal or Atomic* data structures where appropriate and we add thread-safety with zero synchronized statements. Unit tests are added to test for thread-safety.

Issue number: #2283


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@sonarqubecloud
Copy link

@phipag phipag marked this pull request as ready for review November 13, 2025 15:24
@phipag phipag requested a review from svozza November 13, 2025 15:24
@phipag phipag moved this from Working on it to Pending review in Powertools for AWS Lambda (Java) Nov 13, 2025
@phipag phipag linked an issue Nov 13, 2025 that may be closed by this pull request
2 tasks
@phipag phipag merged commit 286a2d0 into main Nov 13, 2025
22 checks passed
@phipag phipag deleted the phipag/issue2283 branch November 13, 2025 16:22
@github-project-automation github-project-automation bot moved this from Pending review to Coming soon in Powertools for AWS Lambda (Java) Nov 13, 2025
@phipag phipag changed the title improv(parameters): Make parameters top-level provider thread-safe fo… improv(parameters): Make parameters utility thread-safe Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Coming soon

Development

Successfully merging this pull request may close these issues.

Maintenance: Make Parameters utility thread-safe

2 participants