dom4j 中PerThreadSingleton和SimpleSingleton的区别是什么?
[b]问题补充:[/b]
[quote="lovewhzlq"]
SimpleSingleton 是一个SingletonStrategy接口的实现,用于提供共同工厂获得相同的对象实例。本实现将建立一个新的实例从指定类,之后不会创建一个新的实例了,除非它重置。
PerThreadSingleton是一个SingletonStrategy接口的实现(提供获得一个单一的对象实例通用工厂)基于每线程一个对象实例的策略。方便代替ThreadLocal的使用。
[/quote]
SimpleSingleton 是不是整个系统就一个实例?这个和static没有什么区别吧?谢谢!
SimpleSingleton 是整个系统就一个实例,
就和一般的单例模式没什么差啦
SimpleSingleton
is an implementation of the SingletonStrategy interface used to provide common factory access for the same object instance. This implementation will create a new instance from the class specified and will not create a new one unless it is reset.
SimpleSingleton 是一个SingletonStrategy接口的实现,用于提供共同工厂获得相同的对象实例。本实现将建立一个新的实例从指定类,之后不会创建一个新的实例了,除非它重置。
PerThreadSingleton
is an implementation of the SingletonStrategy used to provide common factory access to a single object instance based on an implementation strategy for one object instance per thread. This is useful in replace of the ThreadLocal usage.
PerThreadSingleton是一个SingletonStrategy接口的实现(提供获得一个单一的对象实例通用工厂)基于每线程一个对象实例的策略。方便代替ThreadLocal的使用。