多个单例对象存在于两个或多个虚拟机中。
多个单例对象被不同的类加载器同时加载。
Multiple singletons simultaneously loaded by different class loaders.
在这种情况下,一个新的单例对象会被创建。
我们正在做的一件事是支持集群的单例服务。
One of the things we are working on is support for clustered singleton services.
例如,看一下清单1内所示的这个连接池单例。
For example, take a look at the connection pool singleton in Listing 1.
那么,要怎么样来使用单例提供者呢?
单例创建模式是一个通用的编程习语。
The Singleton creation pattern is a common programming idiom.
通过使用这种功能,您可以使用流行的单例模式。
Through this functionality, you can use the popular singleton pattern.
您可以像调用静态方法一样访问单例对象的方法。
You can access methods on singleton objects similar to how you would call static methods.
一种常见用法是用于存储非线程安全类型的单例。
One common use is for storing a singleton of a type that is not thread-safe.
清单4显示了使用方法而非属性来指定适当类的单例。
Listing 4 shows a version of the singleton that USES a method instead of an attribute to specify the appropriate class.
UI组件和应用对象(这是一个单例)都能收到系统事件。
Both UI components and the Application object (which is a singleton) can receive system events.
静态getInstance方法包含单例的模板代码。
The static getInstance method contains the template code for a singleton.
还记得吗,object表示 Scala中的一个单例。
我坚信,在大多数的框架中,使用单例模式时,考虑得都太少了。
It is my true belief that Singleton patterns have been used with far too little thought in most frameworks.
单例对象被垃圾回收机制回收,然后单例类又被重新加载。
Singleton classes destroyed by garbage collection, then reloaded.
相反您可以定义一个对象(而不是类)并且它将成为类的一个单例实例。
Instead you can define some as an object (instead of a class) and it becomes a singleton instance of the class.
Singletonbean是一个在所属容器上下文中的单例对象。
A singleton bean is a singleton in the context of the owning container.
当该构造方法运行的同时,恰好被另一线程访问,两个单例对象将被创建。
Two singletons will be created if the constructor runs and simultaneously another thread calls the method.
由于子类的实例也是单例类的实例,所以可能出现多个单例实例并存的情况。
Since an instance of a subclass is an instance of your superclass, you could find multiple instances of the singleton.
因此,除非仔细计划,否则应该避免使用JAX - RS资源的单例实例。
Therefore, use of a singleton instance for JAX-RS resources should be avoided unless carefully planned.
他们会发现每次他们要创建一个不同的单例类的时候,都不得不写同样得代码。
Those who use it will find that they often have to write the same code each time they want to create a different Singleton class.
当单例类的副本运行于多个虚拟机中时,每个虚拟机都会为其创建一个实例对象。
When copies of the singleton class run in multiple VMs, an instance is created for each machine.
单例模式确实能够轻而易举解决无须对每个类的引用都进行存储的问题。
They easily solve the problem of not having to store references to every class.
Spring之前为bean提供了两种作用域:单例和原型(或者叫非单例)。
Spring has traditionally offered two scopes for beans: singleton and Prototype (or non-singleton).
单例模式是一种有用的控制类访问的途径,他能保证只有一个类实例存在。
Singletons are a useful way to control access to a class, making sure that only one instance can exist.
更有甚者,单例对象能够被状态化;这样,它们可以作为一个状态仓库向外提供服务。
Moreover, singletons can be stateful; in this case, their role is to serve as a unique repository of state.
单例、生成器和工厂方法设计模式被视为是创建型的模式,因它们可协助对象的构建。
The singleton, builder, and factory method design patterns are considered creational patterns, as they assist in the construction of objects.
单例模式同样用于控制像数据库连接或者sockets这样的资源访问。
Singletons often control access to resources such as database connections or sockets.
首先,XML是一个Scala对象,即它是一个单例(singleton)对象。
First, XML is a Scala object. That is, it is a singleton object.
应用推荐