Files
java-design-patterns/thread-specific-storage/etc/thread-specific-storage.urm.puml
T
CMD137andGitHub e8595393d6 feat: Add Thread-Specific Storage design pattern (#3422)
* Add Thread-Specific Storage design pattern

* fixed:pom.xml
Run 'mvn spotless:apply' to fix these violations.

* fix: address Sonar security hotspots for Random usage and e.printStackTrace()

* fixed:
Run 'mvn spotless:apply'(remove unused import)

* fixed:
Refactor Thread-Specific Storage pattern implementation to address Sonar issues: remove unnecessary instantiation, add private constructor, use diamond operator, and update tests.

* fixed:
update uml and README.md

* Trigger CI rerun
2026-06-01 21:11:47 +03:00

41 lines
901 B
Plaintext

@startuml
package thread-specific-storage {
class APP {
+ {static} main(args : String[]) : void
}
class Thread {
+ start() : void
}
class UserContext {
- userId : Long
+ UserContext(userId : Long)
+ getUserId() : Long
+ setUserId(userId : Long) : void
}
class UserContextProxy {
- {static} userContextHolder : ThreadLocal<UserContext>
+ {static} set(context : UserContext) : void
+ {static} get() : UserContext
+ {static} clear() : void
}
class RequestHandler {
- token : String
+ RequestHandler(token : String)
+ process() : void
- parseToken(token : String) : Long
}
UserContextProxy --> UserContext : manages
RequestHandler --> UserContextProxy : uses static
RequestHandler --> UserContext : creates
APP --> RequestHandler : creates
APP --> Thread : starts
Thread --> RequestHandler : executes
}
@enduml