swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Fix thread safety in `Json.mapper()`

Open vuriaval opened this issue 1 year ago • 0 comments

Closes #4672

Instead of following the suggested approach in the issue, a more elegant method was used, where the initialization is delegated to the JVM code for static initialization.

See https://stackoverflow.com/questions/8297705/how-to-implement-thread-safe-lazy-initialization for a thread about this implementation. See also https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom for the chosen pattern.

vuriaval avatar Jul 14 '24 01:07 vuriaval