The design of this class ensures that only one Singleton object is ever created.
此类的设计确保只创建一个Singleton对象。
So if you serialize one singleton twice, the two serialized objects take on separate identities.
所以如果两次序列化一个单例对象,这两个序列化得到的对象会持有两个不同的标识。
As its name suggests, the Singleton Pattern is typically used when you want only one instance of a particular class.
如其名称所暗示的,当您想要特别类的仅仅一个实例时,才使用Singleton模式。
It is often seen as an antidote for many of the problems that using Singleton brings in its wake (and, as an aside, Singleton was one pattern we did _not_ include in the book :->).
它常常被视为使用Singleton之后带来的许多问题的解毒剂(并且,作为题外话,Singleton是我们没有包含在本书中的一个模式:->)。
The singleton is a useful design pattern for allowing only one instance of your class, but common mistakes can inadvertently allow more than one instance to be created.
单例模式是一种非常有用的设计模式,它允许你的类对外只提供一个实例,但是常犯的错误在于不止一个实例被创建。
This class is a singleton, meaning there's only one map of running server instances for all projects.
这是一个惟一的类,也就意味着所有项目正在运行的服务器实例只有一个惟一的映射。
After discussing how to implement the singleton, I'll go over the sometimes surprising causes for the phenomena one by one, showing you how they occur and how you can avoid making those mistakes.
在讨论了如何实现单例模式之后,我会逐一介绍这些时而出现的诡异现象,讲解它们是怎么出现的以及如何去避免犯错。
One of the things we are working on is support for clustered singleton services.
我们正在做的一件事是支持集群的单例服务。
We don't really need more than one instance here, so a singleton is fine.
我们实际上并不需要更多的实例,所以单体模式也不错。
The first component to move towards the service locator design, and away from its singleton origins, is the one that depends on no other singletons, yet may be depended by other singletons.
迈向服务定位器设计、摆脱单件血统的第一个组件是不依赖于其它单件、但被其它单件依赖的组件。
One common use is for storing a singleton of a type that is not thread-safe.
一种常见用法是用于存储非线程安全类型的单例。
These requests for a token are serviced by a singleton class named Dashboard, which manages the status of the endpoints of one or several groups.
获取令牌的请求由一个名为Dashboard的单态类进行处理,该类负责管理一个或多个组的端点的状态。
For event sequencing to work properly, this value must remain one so that all requests are processed for sequencing by the same singleton.
为了能让事件排序正确工作,此值必须保持为1以便所有请求都能被相同的singleton做排序处理。
We made our database a singleton in order to limit the database class to only one instance.
我们将数据库当作一个单实例对象,以将database类限制为1个实例。
If you use singleton aspects (the default), any change you make to an aspect's fields, such as replacing one with a mock, must be undone at the end of the test.
如果使用单元素方面(默认的),那么对于方面的字段所做的所有改变,如用mock替换一个字段,在测试结束时都必须撤销。
Instead, Scala supports a singleton object construct to support those cases where exactly one instance of a type is needed.
相反,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。
Since there can be only one un-caught handler per process active at a time, the constructor should be invoked only once; hence, the reason for the singleton pattern.
因为每次只能有一个未捕获的处理程序处理一个活动进程,构造函数应该只被调用一次,因此要采用singleton模式。
Using the Singleton pattern we guarantee that no matter how many times the BusinessLayerProxy tries to create a CommandFactory, only one instance will exist.
使用Singleton模式,我们可以保证无论BusinessLayerProxy多少次尝试建立CommandFactory,也只存在一个实例。
Singleton Pattern Ensure a class has one instance, and provide a global point of access to it.
确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。
The first one is a pointer to the object that you will be returning and that will implement a singleton .
第一个是对的对象,您将返回,这将实现一个单身指针。
Classes implementing Singleton pattern will ensure that only one instance of the object ever exists at any one time.
使用类来实现单例模式可以确保在任何时间只有一个实例对象。
Singleton: one instance of a class or one value accessible globally in an application.
单例:保证一个类仅有一个实例,并提供一个访问它的全局访问点。
Wareham RSPB nature reserve worker Mark Singleton said: 'This is the first one that has been found in Dorset in 35 years.
韦勒姆皇家鸟类保护协会自然保护区的工人马克·辛格尔顿说:'这是赛特35年来发现的第一只。
In a bucket chart, the planets are arranged in one half of the chart with one planet called a "singleton" is alone on the opposite side.
在提桶型的本命盘上,其他星星都集中分布在星盘的半边里,只留下一颗在另一边。
A singleton class means that it is designed to have only one instance throughout the lifetime of the program.
一个单独的类,它的设计了程序的整个一生只有一个实例。
All calls to a singleton object are handled by one instance of that object.
所有对单一物件的呼叫都是由该物件的一个执行个体所处理。
All calls to a singleton object are handled by one instance of that object.
所有对单一物件的呼叫都是由该物件的一个执行个体所处理。
应用推荐