Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30508
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: SingletonFactory and safe publication |
| Date | 2014-12-08 08:48 +0100 |
| Message-ID | <cel3e3FelmU1@mid.individual.net> (permalink) |
| References | <d4222d17-944c-4042-a05c-7085aecbb400@googlegroups.com> <m5lheu$2c3$1@dont-email.me> <547e50bb$0$304$14726298@news.sunsite.dk> <m5n81h$fq2$1@dont-email.me> <547fc820$0$296$14726298@news.sunsite.dk> |
On 04.12.2014 03:34, Arne Vajhøj wrote: > I have a strong feeling that all the effort "optimizing" singleton > pattern is ridiculous compared to the significance of the problem. > > This has been discussed over and over again by some of the > brightest Java people for more than a decade. > > And I have never heard of a case where the trivial solution > of making the getInstance method synchronized was shown > to actually have a significant negative impact on application > performance. I second that. Plus, if it _does_ have an impact then initializing the instance at the time the factory instance is created and removing the synchronization usually is the best solution. Granted, the instance may be created prematurly but if the synchronization has an impact then it's because there are so many accesses to the singleton throughout a long running program - in that case a bit of lag during application start is often negligible if the application runs faster then. Kind regards robert
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
SingletonFactory and safe publication John <xsli2@yahoo.com> - 2014-12-01 18:16 -0800
Re: SingletonFactory and safe publication Arne Vajhøj <arne@vajhoej.dk> - 2014-12-01 21:34 -0500
Re: SingletonFactory and safe publication Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-12-02 18:20 -0500
Re: SingletonFactory and safe publication Arne Vajhøj <arne@vajhoej.dk> - 2014-12-02 18:52 -0500
Re: SingletonFactory and safe publication Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-12-03 09:51 -0500
Re: SingletonFactory and safe publication Arne Vajhøj <arne@vajhoej.dk> - 2014-12-03 21:29 -0500
Re: SingletonFactory and safe publication Arne Vajhøj <arne@vajhoej.dk> - 2014-12-03 21:34 -0500
Re: SingletonFactory and safe publication Robert Klemme <shortcutter@googlemail.com> - 2014-12-08 08:48 +0100
Re: SingletonFactory and safe publication Lew <lewbloch@gmail.com> - 2015-01-04 16:15 -0800
csiph-web