Remove TransactionManager's static ThreadLocal context mapping - #772
Merged
Merged
Conversation
The TM set two static ThreadLocals around each transaction's participant run and exposed them through the static accessors getSerializable(), getContext() and getId(). With virtual threads and a large session count that per-thread state is a leak vector, and the context already reaches every participant as a parameter. No caller exists in jPOS, jPOS-EE or the Control Plane. Closes #770
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #770.
What
Removes from
TransactionManager:ThreadLocalfields holding the current transaction's context and id,setThreadLocal/removeThreadLocalhelpers and their call sites around the participant run,getSerializable(),getContext()andgetId().Why
With virtual threads and a large session count, per-thread state set and cleared on every transaction is a leak vector and ambient state the taxonomy work deliberately avoids: the trace id travels in the
Context(#769), not in a thread-local. Every participant already receives the id and the context as parameters.Impact
No caller of the three accessors exists in jPOS main or test sources, the docbook, jPOS-EE, or the Control Plane. They were public API, so:
Release note.
TransactionManager.getSerializable(),getContext()andgetId()are removed. Code that used them to reach the current context from a helper invoked inside a participant must receive the context as a parameter instead.Tests
No test change needed. Full
:jpos:testand:jpos:javadocpass.