|
Take a look
at the following links. I think they explain the Singleton problem…. but not
understanding all of it, I could be wrong!!! Both links
come from The
Java™ Specialists' Newsletter Archive, which has stuff that may even
challenge JDJLIST members! Regards Andrew -----Original
Message----- "Helper" initializers vs.
"Lazy double instantiation" for static singletons are very well
explained in the "Effective Java" by J. Bloch. I think he
prefers the Helpers because of some esoteric JVM properties that only he and
Gosling know intimately. I've never seen a good article on it, but I'm now
reading the link below. Looks good so far! Thanks! :-) Greg -----Original Message----- On Wed, 2 Apr 2003 05:19:13 -0800 (PST) You know after reading the article you
posted above and your comment <article quote> Just define the singleton as a static
field in a separate class. The class HelperSingleton { So, unless I'm wrong it appears I don't
need the locking code? and could //class Store private static List someList = null; static { //or I suppose I could do: Would the above work? I wasn't sure what
would happen if at the same "Ok, any other classes that create a
Store don't execute the static OR, even though the full instance might
not yet be created of the class, "Hey, I'm working on creating an
instance of Store and I'm in the static I guess that later is what is happening?
If that's the case then it Thanks for all your comments so far. -- --- --- You are currently subscribed to jdjlist as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] http://www.sys-con.com/fusetalk |
Title: RE: [jdjlist] Re: Singletons and is this design ok?
- [jdjlist] Re: Singletons and is this design ok? duff
- [jdjlist] Re: Singletons and is this design ok? Rick Reumann
- [jdjlist] Re: Singletons and is this design ok? Phillip DuLion
- [jdjlist] RE: Singletons and is this design ok? Alastair Rodgers
- [jdjlist] Re: Singletons and is this design ok? Barzilai Spinak
- [jdjlist] Re: Singletons and is this design ok? Rick Reumann
- [jdjlist] Re: Singletons and is this design ok? Barzilai Spinak
- [jdjlist] Re: Singletons and is this design ok? Greg Nudelman
- [jdjlist] Re: Singletons and is this design ok? Andrew Rendle
- [jdjlist] Re: Singletons and is this design ok? Rick Reumann
- [jdjlist] Re: Singletons and is this design ok? Alastair Rodgers
