Description
methods should be synchronized.
Background information:
In a multi-threaded situation, un-synchronized lazy initialization of non-volatile fields could mean that a second thread has access to a half-initialized object while the first thread is still creating it. Allowing such access could cause serious bugs. Instead. the initialization block should be synchronized or the variable made volatile. Similarly, updates of such fields should also be synchronized.