读书人

单例模式跟软引用[Soft Singleton Idi

发布时间: 2012-08-27 21:21:57 作者: rapoo

单例模式和软引用[Soft Singleton Idiom]

原文出自:http://www.javaworld.com/community/node/7692

?

There are two ways singletons are created using the Double Check Locking and the Holder Idiom for lazy loading. Both of them create a static singleton object which does not help garbage collection much.
In search of a new way to create singleton without using static object came across this solution which gets rid of creating object in static way and also helps garbage collection as we wrap singleton object with Soft Reference.

?


?

?

?

?

?

?

?

读书人网 >软件架构设计

热点推荐