As a result, instance is now non-null and refers to a valid Singleton object.
结果是,instance现在为非null并引用一个有效的Singleton对象。
Lines CA and D0 represent the inline constructor storing the values true and 5 into the Singleton object.
CA和d0行表示内联的构造函数,该构造函数将值true和5存储到Singleton对象。
This line of code creates a Singleton object and initializes the variable instance to refer to this object.
此行代码创建了一个Singleton对象并初始化变量instance来引用此对象。
When the first thread exits the synchronized block, the waiting thread enters and creates another Singleton object.
当第一个线程退出synchronized块时,等待着的线程进入并创建另一个Singleton对象。
The code at BE allocates the memory from the heap for the Singleton object and stores a pointer to that memory in eax.
be处的代码为Singleton对象从堆中分配内存,并将一个指向该块内存的指针存储到eax中。
This line is supposed to ensure that instance will only ever be null or refer to a fully constructed Singleton object.
此行应该确保instance只为null或引用一个构造完整的Singleton对象。
Thread 1 completes the initialization of the Singleton object by running its constructor and returns a reference to it.
线程1通过运行Singleton对象的构造函数并将引用返回给它,来完成对该对象的初始化。
Because it is not, thread 2 returns the instance reference to a fully constructed, but partially initialized, Singleton object.
因为实例不为null,线程2将instance引用返回给一个构造完整但部分初始化了的Singleton对象。
Instead, Scala supports a singleton object construct to support those cases where exactly one instance of a type is needed.
相反,Scala支持单例模式,可以应用于那些一种类型只有一个实例的情况。
Now, we can call the reset method to start off each test run to ensure we are going through the initialization code for the singleton object on every test run.
现在,我们可以在每次测试之前调用reset方法,保证我们在每次测试过程中都会先执行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.)
为了更加智能化,编译器优化会在单例对象所有域完全初始化前就创建该单例对象(参见《重复检查锁的致命点》)。
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.
此类提供了一组类或一组单例(singleton)对象实例,在一个 JAX-RS 应用程序内包括所有的根级别的资源和提供程序(由 @Provider注释的类)。
The instance fields of the singleton will not be globally unique. Because several VMs are involved for what appears to be the same object, several singleton objects might be brought into existence.
原因在于多个虚拟机都可以涉及到相同的单实例类,这些单实例对象可能会同时存在于上下文中,从而导致这些单实例对象并不是全局唯一的。
In the constructor of StockQuoteGenerator class, which is a singleton class, we are starting a new thread and assigning a Runnable object to that thread.
在stockquotegenerator类(一个单态类)的构造函数中,我们启动了一个新线程,并向该线程分配了一个Runnable对象。
You will design the object as a singleton (this design pattern will limit this object to a single instance) and have the appropriate retrieve and store methods to manipulate the cache.
您将把对象设计为一个单子实例 (singleton)(这个设计模式将把这个对象限制在一个单个实例中)并使用合适的检索和存储方法对高速缓存进行操作。
Instead you can define some as an object (instead of a class) and it becomes a singleton instance of the class.
相反您可以定义一个对象(而不是类)并且它将成为类的一个单例实例。
This singleton is the root management object that starts and stops all other management tasks.
这个单实例对象是根用户管理对象,启动和停止所有其他管理任务。
Both UI components and the Application object (which is a singleton) can receive system events.
UI组件和应用对象(这是一个单例)都能收到系统事件。
With all those mechanisms, a reconstituted object loses its referential identity, and you have to consider carefully whether your singleton is still a singleton.
使用这些序列化机制时,被重建的对象将失去原对象的相关标识,所有必须特别注意单例对象是否依然是单例的。
In order to reduce memory usage, the resource bundle object is static and singleton.
为了减少内存使用,资源对象是静态和单一的。
The singleton provides us with the means to store another object that is used for the aggregation done in each UDF in the SQL statement.
单件为我们提供了一种可以将SQL 语句中每一个UDF 进行聚集计算时需要的数据存储在另外的对象当中的方式。
The singleton pattern can be used to delay the initialization of an object as long as possible.
单元素模式可以用来尽可能久地延迟对象的初始化。
The constructor of BookWebApp gets the singleton instance of the book service implementation object.
BookWebApp的构造函数获取这个图书服务实现对象的singleton实例。
The SecurityUtils object is a singleton, which means that different objects can use it to gain access to the current user.
SecurityUtils对象是一个singleton,这意味着不同的对象可以使用它来获得对当前用户的访问。
This is a Scala singleton because it USES the object declaration instead of a class declaration.
这是一个Scala单例(singleton),因为它使用对象声明,而不是类声明。
While all Spring-managed objects are treated as singleton instances by default, it is sometimes necessary to specify an alternate "scope" for an object.
虽然所有Spring管理对象都被默认地当作单例实例来处理,但有些时候还是有必要为某个对象指明一个备用的范围(scope)。
Next, UnitsConverter is also a singleton as it is defined using the object keyword.
接下来,UnitsConverter也是一个单例模式,因为它是使用object关键词定义的。
Remember that object denotes a singleton in Scala.
还记得吗,object表示 Scala中的一个单例。
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.
单例模式可能是最常用的OOP设计模式之一了;它限制了一个类的对象实例数只能为1。
In this case, you are just configuring an object which you have already created. Are you sure you need the singleton interface?
在这种情况下,你只是配置一个对象,您已经创建了。你确定你需要单独的接口?
应用推荐