Skip to content

Fix thread safety of thread-bound transactions in PulsarTemplate#1515

Open
Dream95 wants to merge 1 commit into
spring-projects:mainfrom
Dream95:fix/pulsar-template-threadlocal-transactions
Open

Fix thread safety of thread-bound transactions in PulsarTemplate#1515
Dream95 wants to merge 1 commit into
spring-projects:mainfrom
Dream95:fix/pulsar-template-threadlocal-transactions

Conversation

@Dream95

@Dream95 Dream95 commented Jun 9, 2026

Copy link
Copy Markdown

PulsarTemplate stored per-thread transactions in a HashMap keyed by Thread. HashMap is not thread-safe, so concurrent use of a shared PulsarTemplate instance could lose transaction bindings.

Replace with ThreadLocal to correctly scope transaction state per thread without shared mutable map access.

PulsarTemplate stored per-thread transactions in a HashMap keyed by
Thread. HashMap is not thread-safe, so concurrent use of a shared
PulsarTemplate instance could lose transaction bindings.
Replace with ThreadLocal to correctly scope transaction state per
thread without shared mutable map access.

Signed-off-by: Dream95 <zhou_8621@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant