Erik Weber wrote the following on 1/26/2005 2:44 PM:
It is useful to note that it is theoretically possible for two competing Threads to enter the setData method and get past the "if (! isInitialized)" statement before one of them changes the value to true, causing possible data corruption. This is why I prefer to initialize singletons either in a static initializer or at the time of declaration. Practically of course, there may be no such threat at all.

+1 Excellent point.

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to