Other instances in which this pattern is useful include logging and printing, such as when you want only one instance of a class to access and control one particular printer at a time.
在其他实例中,此模式也是有用的,包括登录和打印,例如,当您想要一个能够每次访问并控制一个特别打印机的类实例。
Singletons are a useful way to control access to a class, making sure that only one instance can exist.
单例模式是一种有用的控制类访问的途径,他能保证只有一个类实例存在。
For example, for a queue, an MQQUEUE profile is used to control MQI access to the queue, but other profiles in the MQADMIN class are used to control context and alternate user security.
例如,对于队列,使用一个MQQUEUE概要文件来控制对该队列的访问,但是mqadmin类中的其他概要文件用于控制上下文和用户安全性。
应用推荐