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
The public static method mapper() like below is not thread safe. It appears that the "mapper" field is designed to be lazily initialized and only initialize once. But current implementation does not guarantee the mapper field is initialized only once. If we want the lazy and only once initialization semantic, we need to use double checked locking or simply synchronize the mapper() method, otherwise, the mapper has chance to be initialized multiple times.
The public static method mapper() like below is not thread safe. It appears that the "mapper" field is designed to be lazily initialized and only initialize once. But current implementation does not guarantee the mapper field is initialized only once. If we want the lazy and only once initialization semantic, we need to use double checked locking or simply synchronize the mapper() method, otherwise, the mapper has chance to be initialized multiple times.
current implementation:
suggested implementation using double checked locking
The text was updated successfully, but these errors were encountered: