You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
When I'm using Swagger for API document generation and found below issue. This issue exists across multiple tags and event in the master and Json31 class.
The public static method mapper() like below is not thread safe. It appears that the "mapper" field is designed to be lazily initialized and want to initialize only once. But current implementation does not give this guarantee. If we want the lazy and only once initialization semantic, we need to use double checked locking or simply synchronize the mapper() method or use private static class, otherwise, the mapper has chance to be initialized multiple times by different threads in multi threads scenario.
Hi,
When I'm using Swagger for API document generation and found below issue. This issue exists across multiple tags and event in the master and Json31 class.
The public static method mapper() like below is not thread safe. It appears that the "mapper" field is designed to be lazily initialized and want to initialize only once. But current implementation does not give this guarantee. If we want the lazy and only once initialization semantic, we need to use double checked locking or simply synchronize the mapper() method or use private static class, otherwise, the mapper has chance to be initialized multiple times by different threads in multi threads scenario.
current implementation:
suggested implementation using double checked locking
The text was updated successfully, but these errors were encountered: