• When would you use a class with static members and when would you use a Singleton class?

    什么时候使用带有静态成员,什么时候使用例?

    youdao

  • Registers a class definition with this container and marks the class as a singleton class.

    这个容器注册定义将该类定义一个单独的类。

    youdao

  • When copies of the singleton class run in multiple VMs, an instance is created for each machine.

    单例副本运行多个虚拟中时,每个虚拟机都会创建一个实例对象

    youdao

  • MockupDB, illustrated in Listing 3, is singleton class that simulates a database of customer orders.

    清单3所示MockupDB是个单体模拟客户订单数据库

    youdao

  • When a singleton class is garbage-collected and then reloaded, a new singleton instance is created.

    对象被当着垃圾回收然后该单例又被重新加载,一个新的单例对象创建

    youdao

  • BookServiceImpl is a singleton class that USES an in-memory map to maintain the collection of book objects.

    BookService Implsingleton使用内存映射图(in - memory map)维护图书对象集合

    youdao

  • The Application class is a singleton class that acts as a controller for all of the application's operations.

    Application一个单身类(singleton class),用作应用程序所有操作控制器

    youdao

  • A singleton class means that it is designed to have only one instance throughout the lifetime of the program.

    单独设计了程序整个一生只有实例

    youdao

  • 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.

    他们发现每次他们创建一个不同单例时候,都不得不同样代码

    youdao

  • The GameService class, in Listing 10, is a singleton class that represents the game server and the current state of the given game.

    清单10中的gameservice一个单例类,代表给定游戏游戏服务器当前状态

    youdao

  • The component consists of a singleton class named PoIdGenerator, exposing a simple API, and responsible for managing blocks of POIDs.

    这个组件名为 PoIdGenerator 的单一类组成,它公开一个简单API并且负责管理POID 块

    youdao

  • 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单态进行处理,该类负责管理多个端点状态

    youdao

  • 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对象

    youdao

  • Instead you can define some as an object (instead of a class) and it becomes a singleton instance of the class.

    相反可以定义对象(而不是)并且将成为单例实例

    youdao

  • A simple optimization to this code would be to apply the Singleton design pattern to class Empty, because every instance of Empty is identical.

    段代码简单优化empty应用同一个设计类型因为一个Empty的实例同样的。

    youdao

  • By using a ThreadLocal in our Singleton, as shown in Listing 3, we can allow any class in our program to easily acquire a reference to a per-thread Connection.

    如清单3通过使用“单子”中的ThreadLocal我们就能我们程序中的任何容易获取每线程Connection的一个引用

    youdao

  • As its name suggests, the Singleton Pattern is typically used when you want only one instance of a particular class.

    如其名称所暗示想要特别类的仅仅一个实例时,才使用Singleton模式

    youdao

  • Most caches are implemented using the Singleton pattern involving a static reference to a top level cache class as shown in this example.

    使用Singleton模式实现大多数缓存涉及示的顶级cache静态引用

    youdao

  • Users of the class can then add and remove Attendee elements from the collection the Singleton instance holds, or replace the elements in the collection.

    然后该类用户可以Singleton实例保存集合中添加删除Attendee元素替换集合中的元素。

    youdao

  • The Message singleton serves as a metadata repository and factory class for the Message class.

    单实例对象Message作为message存储库工厂类。

    youdao

  • MembersAppDomainPMF (found under AcmeMemberAppWeb > src > org.acme.membership.jdo) is the class where we have placed our singleton PersistenceManagerFactory attribute.

    MembersAppDomainPMF(可以在AcmeMemberAppWeb >src > org.acme.membership.jdo 下面找到就是我们放置框架PersistenceManagerFactory属性位置的

    youdao

  • This class is a singleton, meaning there's only one map of running server instances for all projects.

    惟一意味着所有项目正在运行服务器实例只有一个惟一的映射

    youdao

  • The only other method (set in italics) in the class is used to get a reference to the singleton and to create it if it is not yet instantiated.

    该类仅剩方法(用斜体标识)用于获取单件的一个引用如果尚未实例化则创建

    youdao

  • 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.

    例模式非常有用设计模式,它允许对外提供实例但是犯的错误在于不止一个实例创建。

    youdao

  • This has the added benefit of separating singleton code from the class code leaving the flexibility to use several instances of the class or using the class as a singleton.

    这样分离例结构代码有利于保持按单例模式使用不按单例模式使用类的灵活性

    youdao

  • This is a class that can be used repeatedly to instantiate a class as a singleton without having to re-write the singleton pattern code for that specific class.

    一个可用创建实例需要每个特定的重写单例模式代码可重用的类。

    youdao

  • An example use case for a singleton would be a database connection pool: you don't want your application to have multiple resource-intensive instances of a connection pool class.

    比如数据库连接就是单例设计模式一个例子:我们一般不想应用程序具有连接池类的多个资源密集型实例

    youdao

  • 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.

    由于单例对象作为实例存在而不是静态成员,所以能够惰性初始例对象,即需要在第一次用时候去创建它。

    youdao

  • The singleton pattern ensures that only a single instance of a class is normally used by an application, but still allows alternate instances to be created as required.

    元素模式可以确保应用程序通常使用单个实例但是仍然允许根据需要创建备用实例

    youdao

  • Listing 4 shows a version of the singleton that USES a method instead of an attribute to specify the appropriate class.

    清单4显示了使用方法而非属性指定适当单例

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定