Single-Case mode
Categories: Lazy single case, a hungry man type single case, registered single case
Characteristics:
1, the Singleton class can have only one instance.
2. The Singleton class must create its own unique instance itself.
3. The Singleton class must provide this instance to all other objects.
Singleton mode ensures that a class has only one instance, and instantiates itself and provides this instance to the system as a whole
Scenario: Driver objects for thread pools, caches, log objects, dialogs, printers, graphics cards are often designed as singleton
Classic usage:
Singleton prevents classes from being instantiated externally by restricting the construction method to private
Thread safety issues:
This blog does not address thread safety issues: http://www.cnblogs.com/whgw/archive/2011/10/05/2199535.html
Single-Case mode