Unfortunately in Java, Singletons and thread-safety are inextricably linked =( Dhanji.
On Mon, Apr 27, 2009 at 7:09 AM, charlesbos73 <[email protected]> wrote: > > Hi, > > back in the days I wrote my own dependency injection framework. > > Really mostly to "grasp" what DI was all about. And I'm sold :) > > I decided to give Guice a look and one of the very first sentence > I find is this: > > "@Singleton indicates that the class is intended to be threadsafe" > > Now this is the most confusing sentence I've read in a while. > > Should it read: > > "@Singleton indicates that the class is intended to be instantiated > only once and that this instance shall be re-used (re-injected)" > > (and, hence, of course, that it better be thread-safe, but this is a > detail that has nothing to do with what a singleton is). > > Because, really, singletons have nothing to do with thread-safety. > Heck, there are languages that aren't multi-threaded that can > have singletons. > > Is Guice using the term "singleton" to mean something different > than the definition that everyone came to agree on? > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
