Skip to content

[OPENJPA-2954] Publish the cached AttributeConverter instance safely - #185

Merged
cristof merged 1 commit into
masterfrom
OPENJPA-2954
Sep 15, 2026
Merged

cristof merged 1 commit into
masterfrom
OPENJPA-2954

Conversation

@rzo1

@rzo1 rzo1 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

FieldMetaData and ConverterElementHandler are shared across brokers and threads, but they cached the converter instance and its methods in plain fields. Those fields are now volatile, and the instance is created with double-checked locking, so exactly one fully constructed converter is shared. New race tests check this, and the javadoc now says converters must be thread-safe.

FieldMetaData and ConverterElementHandler are shared across brokers and
threads. Make the lazily populated converter caches volatile and create
the converter instance with double-checked locking so exactly one
instance is published. Document that converter instances are shared and
must be thread-safe.
@rzo1 rzo1 self-assigned this Sep 14, 2026
@rzo1
rzo1 requested review from cristof and solomax September 14, 2026 18:10
@cristof
cristof merged commit 882d239 into master Sep 15, 2026
4 checks passed
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.

3 participants