Fórumok
Thread Safety in Singletons and Statics
Bijan Vakili, módosítva 9 év-val korábban
Thread Safety in Singletons and Statics
Expert Bejegyzések: 375 Csatlakozás dátuma: 2009.03.10. Legújabb bejegyzések
Hi would you consider below thread-safe?
com.liferay.portlet.PortletContextFactory
Seems vulnerable to write-over-write
This is template of thread safety issue; same pattern can be found in more places; are we handling this issue somehow?
http://stackoverflow.com/questions/7048198/thread-safe-singletons-in-java
com.liferay.portlet.PortletContextFactory
Seems vulnerable to write-over-write
This is template of thread safety issue; same pattern can be found in more places; are we handling this issue somehow?
http://stackoverflow.com/questions/7048198/thread-safe-singletons-in-java
David H Nebinger, módosítva 9 év-val korábban
RE: Thread Safety in Singletons and Statics (Válasz)
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
It's like a servlet context, you get one (some) created at portlet startup. The context doesn't change during runtime. Sure it's not decorated with the synchronized keyword, but it should be just fine.
Bijan Vakili, módosítva 9 év-val korábban
RE: Thread Safety in Singletons and Statics
Expert Bejegyzések: 375 Csatlakozás dátuma: 2009.03.10. Legújabb bejegyzések
Thanks David; agreed, it is a moot point. I reviewed portal-service and looks fine. Thanks for your prompt and insightful reply.