在这种情况下,一个新的单例对象会被创建。
您可以像调用静态方法一样访问单例对象的方法。
You can access methods on singleton objects similar to how you would call static methods.
多个单例对象存在于两个或多个虚拟机中。
多个单例对象被不同的类加载器同时加载。
Multiple singletons simultaneously loaded by different class loaders.
返回应用程序单例对象。
它是一个单例对象或函数,对外提供特定的功能。
Angular services are singletons objects or functions that carry out specific tasks common to web apps.
单例对象被垃圾回收机制回收,然后单例类又被重新加载。
Singleton classes destroyed by garbage collection, then reloaded.
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.
更有甚者,单例对象能够被状态化;这样,它们可以作为一个状态仓库向外提供服务。
Moreover, singletons can be stateful; in this case, their role is to serve as a unique repository of state.
所以如果两次序列化一个单例对象,这两个序列化得到的对象会持有两个不同的标识。
So if you serialize one singleton twice, the two serialized objects take on separate identities.
当一个单例对象被当着垃圾回收,然后该单例类又被重新加载,一个新的单例对象被创建。
When a singleton class is garbage-collected and then reloaded, a new singleton instance is created.
Ext名称空间全局对象封装了Sencha类库提供的所有的类,单例对象,实用方法。
The Ext namespace (global object) encapsulates all classes, singletons, and utility methods provided by Sencha's libraries.
前面已经简单地介绍了单例模式的实现方式,现在让我们进入主题:两个单例对象如何同时存在?
Now that we've looked briefly at implementation, let's turn to the heart of this article: how two singletons can exist simultaneously.
通常,我们更喜欢使用portlet服务,而不喜欢用惯用的对象,例如单例对象,这是因为。
Generally, we prefer using portlet services over more traditional objects, such as singletons, because.
这篇文章中,讲解了几种会产生多个单例对象的情况,如果你发现了其他的情况,我非常乐意听到它们。
In this article, I've presented some ways that the multiple singleton might emerge. If you've discovered any others, I'd be interested in hearing about them.
使用这些序列化机制时,被重建的对象将失去原对象的相关标识,所有必须特别注意单例对象是否依然是单例的。
With all those mechanisms, a reconstituted object loses its referential identity, and you have to consider carefully whether your singleton is still a singleton.
为了更加智能化,编译器优化会在单例对象所有域完全初始化前就创建该单例对象(参见《重复检查锁的致命点》)。
To wit, compiler optimizations can make the assignment of the new singleton object before all its fields are initialized. (See "Double-checked locking is broken" in Resources.)
由于单例对象作为实例存在而不是类的静态成员,所以你能够惰性地初始化单例对象,即只需要在第一次用它的时候才去创建它。
With singletons implemented as single instances instead of static class members, you can initialize the singleton lazily, creating it only when it is first used.
单例模式-每个依赖服务的组件,都是获得服务工厂生成单个实例的引用。服务是一个单例对象或函数,对外提供特定的功能。
Singletons - Each component dependent on a service gets a reference to the single instance generated by the service factory.
UI组件和应用对象(这是一个单例)都能收到系统事件。
Both UI components and the Application object (which is a singleton) can receive system events.
这是一个Scala单例(singleton),因为它使用对象声明,而不是类声明。
This is a Scala singleton because it USES the object declaration instead of a class declaration.
Jeremy认为大多数开发者都没有正确的使用Ruby对象,所以他的话题比较高阶,谈论了诸如单例类(singleton classes)和instance_eval。
Jeremy believes that most programmers don't use Ruby's objects right, so his talk sheds some light onto advanced topics like singleton classes and the instance_eval.
单例模式的目的在于控制对象的创建,限制对外提供的对象数量为1,同时允许在情况变化时创建更多的实例。
The singleton's purpose is to control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes.
相反您可以定义一个对象(而不是类)并且它将成为类的一个单例实例。
Instead you can define some as an object (instead of a class) and it becomes a singleton instance of the class.
单例、生成器和工厂方法设计模式被视为是创建型的模式,因它们可协助对象的构建。
The singleton, builder, and factory method design patterns are considered creational patterns, as they assist in the construction of objects.
当单例类的副本运行于多个虚拟机中时,每个虚拟机都会为其创建一个实例对象。
When copies of the singleton class run in multiple VMs, an instance is created for each machine.
此类提供了一组类或一组单例(singleton)对象实例,在一个JAX-RS应用程序内包括所有的根级别的资源和提供程序(由 @Provider注释的类)。
This class provides a set of classes, or a set of singleton object instances, that include all of the root-level resources and providers (classes annotated with @Provider) in a JAX-RS application.
单例模式可能是最常用的OOP设计模式之一了;它限制了一个类的对象实例数只能为1。
The singleton pattern is probably one of the most often used OOP design patterns; it restricts the number of object instances of a class to one.
首先,XML是一个Scala对象,即它是一个单例(singleton)对象。
First, XML is a Scala object. That is, it is a singleton object.
应用推荐