-
Notifications
You must be signed in to change notification settings - Fork 8
Fix race condition in JwtDecoder caching with computeIfAbsent #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: buckett <5921+buckett@users.noreply.github.com>
Co-authored-by: buckett <5921+buckett@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a race condition in JWT decoder caching by replacing a non-atomic check-then-act pattern with the atomic computeIfAbsent() operation, ensuring thread-safe creation of JwtDecoder instances.
Key Changes:
- Replaced manual
get()/put()operations withConcurrentHashMap.computeIfAbsent()for atomic decoder creation - Corrected spelling in comment from "it's" to "its"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The
getJwtDecodermethod had a race condition where concurrent threads could create duplicateJwtDecoderinstances for the samejwkSetUridue to non-atomic check-then-act operations.Changes
get()/put()pattern withcomputeIfAbsent()for atomic decoder creationJwtDecoderinstance perjwkSetUriunder concurrent accessBefore:
After:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.