O
O
orbit0702019-06-27 15:12:35
Java
orbit070, 2019-06-27 15:12:35

Why is one of the singletons not synchronized?

Hi everybody.
In one of the Google projects there are two singletons: the first one is for working with local storage, the second one is for working with remote storage.
The question is, why does one singleton have a synchronized block and the other doesn't?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmtm, 2019-06-27
@Dmtm

the first is thread-safe, the second is not
about singletons https://habr.com/en/post/27108/
both are worse than On Demand Holder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question