We could either implement each state as a Singleton, or create a factory of states which creates and manages the states.
我们既可以执行每个状态作为Singleton,也可以创建一个状态工厂用于生成和管理状态。
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元素,或替换集合中的元素。
The Singleton session bean lives for the duration of the container in which it is created but state does not survive a shut-down or a crash of the JVM.
单例sessionbean的生命周期与创建它的容器保持一致,但是其状态会因为JVM的停止或崩溃而丧失。
This line is supposed to ensure that instance will only ever be null or refer to a fully constructed Singleton object.
此行应该确保instance只为null或引用一个构造完整的Singleton对象。
Typical examples include a cached DAO, cache of JNDI references, or any sort of common factory or other component that needs to use the Singleton pattern.
典型的例子有:缓存的DAO,JNDI引用的缓存,或者任何类型的公共工厂或者其他需要使用Singleton模式的组件。
Since it is thread safe by design, you might cache it in a public static final variable, or wrap it in a singleton pattern after creation for later access.
因为根据设计它是线程安全的,创建它之后可以把它缓存在一个公共静态最终变量中,或者包装在单实例模式中以供以后访问。
If you add database connections or use a JDBC driver that allows multithreading, the singleton can be easily adjusted to allow more connections.
当你增加数据库连接或者改而使用支持多线程的JDBC驱动器时,单例模式能够很容易地适应这一变化。
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.
这样分离出单例结构的代码,将有利于保持按单例模式使用类或不按单例模式使用类的灵活性。
Don't over - "design pattern" applications - Sometimes it's just easier to write a simple algorithm than it is to incorporate a singleton or facade pattern.
不要过于注重程序的“设计模式”。有时候,写一个简单的算法,要比引入某种模式更容易。
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的单态类进行处理,该类负责管理一个或多个组的端点的状态。
Configuring singleton aspects is as easy as configuring any other bean inside a Spring container, but what about aspects that have other lifecyles such as perthis, pertarget, or even percflow aspects?
配置单体方面就像在Spring容器中配置其他bean一样简单,但是对于拥有其他生命周期的方面来说,该怎么办呢? 例如 perthis、pertarget甚至percflow 方面?
You can have a SingletonFactory class with a globally accessible map of class names or class objects to singleton instances.
创建一个SingletonFactory类去全局映射类名(或者是类对象)和单实例对象。
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注释的类)。
In this simple example, we set it as a VM-static singleton, but this is usually not necessary - your application configuration mechanism can determine if you need to use static memory or not.
在这个简单示例中,我们将它设置为VM静态Singleton,但这通常不是必须的-你的应用配置机制可以决定你是否需要使用静态存储。
Spring has traditionally offered two scopes for beans: singleton and Prototype (or non-singleton).
Spring之前为bean提供了两种作用域:单例和原型(或者叫非单例)。
There is not significant difference between the attributions of different majors and singleton or not.
文、理科及独生、非独生大学生在不同归因维度上均无显著差异。
Or how do fridge microbes of an urban singleton stack up with those of a suburban family?
城里冰箱里的单个的细菌是怎样和郊区家庭里的细菌堆积联系起来的?
There are no significant differences on the aspects of gender, family, singleton or not and socioeconomic status in total scores.
大学生心理资本总分在性别、城乡、独生子女及家庭社会经济地位等方面未呈现明显差异。
Sometimes it's just easier to write a simple algorithm than it is to incorporate a singleton or facade pattern.
有时候,写一个简单的算法,要比引入某种模式更容易。
Sometimes it's just easier to write a simple algorithm than it is to incorporate a singleton or facade pattern.
有时候,写一个简单的算法,要比引入某种模式更容易。
应用推荐