使用对象池限制特定类的实例的数量。
Object pools are used to restrict the number of instances of a certain class.
无范围用于不使用对象池的对象。
让我们考虑一个可以有效使用对象池的方案。
Let's consider a scenario in which object pooling would be useful.
在使用对象池时,分配、初始化、回收和终结只发生一次,从而减少了内存使用和所需的处理时间。
When using an object pool, the allocation, initialization, collection, and finalization only occur once, reducing both the memory usage and the processing time that is required.
运行时:在响应时间和CPU的消耗两者上性能的下降(即使当使用对象池时),明显有着复杂嵌套对象。
Run time: performance degradation (even when using object pools), both in response time and CPU consumption, is evident with complex nested objects.
只 有那些生存周期很长的对象,才适合使用对象池技术,因为对它们进行垃圾回收的成本很高。
It's the long-lived objects, such as ones you might pool, that are expensive to garbage collect.
此规则不仅适用于向数据池添加值,然后使用它们,而且还适用于直接在对象之间复制和粘贴值。
This rule applies not only to adding values to the data pool and then using them, but also when you directly copy and paste values between objects.
通过使用数据源对象,您可以访问一个连接数据源的连接池。
By using data source objects, you have access to a pool of connections to a data source.
为了在使用并发消息传递时优化性能,我们必须将注意力转向应用程序服务器托管的许多对象池。
To tune performance when using concurrent message delivery, we must turn our attention to a number of object pools managed by the application server.
对代理和调用程序对象进行缓存,配合执行程序中的线程池,可以提高资源的使用效率。
The caching of proxy and invoker objects supported efficient use of resources, along with pooling of threads in the executor.
同样地,应用程序设计也能调优性能:更少的对象创建、实时的数据库优化以及使用数据库连接池。
Similarly the application design can be tuned for performance: Fewer object creations, ongoing database refinements, and using database connection pooling.
由于连接池有许多优点,所以在Web应用程序中偏爱使用数据源对象的方法来处理数据库连接。
Because of the advantages of connection pooling, using data source objects is the preferred method of handling database connections in Web applications.
ReleaseObject方法在内部使用私有的ReturnToPool 方法,用给定对象重新填充该池,如图5 所示。
The ReleaseObject method internally uses a private ReturnToPool method to restock the pool with the given object, shown in Figure 5 .
在那种情况下,因为池管理器预先在启动时创建连接对象,所以,J2EE组件可以使用连接对象,而不会导致数据库资源管理器上的系统开销。
In that situation, a J2EE component can use connection objects without causing overheads on the database resource manager, since a pool manager creates the connection objects up front, at startup.
当这个对象完成它的工作之后,它被返回给池,可供以后重新使用。
After the object finishes its job, it is returned back to the pool and can be reused later.
如果对象的使用频率不高,或者对象的创建或销毁成本不高,则对象池可能不是正确的策略。
If your objects are not used with high frequency or do not have a high creation or destruction cost, then object pooling might not be the right strategy.
资源管理器会使用容器提供的对象池来管理系统资源。
The resource manager USES the object pool provided by the container to manage system resources.
如果对象池大小没有正确调优,许多未使用的对象实例最终会被闲置,耗尽内存而不产生任何价值。
If the pool size is not tuned correctly, many unused object instances can end up hanging around, using up memory without contributing value.
池机制相当简单:对象被重新使用,而不是让它被垃圾回收器回收。
Pooling is quite simple: an object is reused instead of allowing it to be reclaimed by the garbage collector.
前面的方法返回一个布尔值,用于显示处理程序能否被对象池使用。
The former returns a Boolean value that indicates whether the handler can be pooled.
对大多数收集器实现而言,分配子系统持有一个自由堆内存池,应用程序通过分配对象使用该池,然后由收集器通过清理来补充该池。
For most collector implementations, the allocation subsystem keeps a pool of free heap memory, consumed by the application through allocating objects and replenished by the collector through sweeping.
您使用list_entry来获取您的数据对象(以便将它释放回内核池),然后使用list_del来释放列表中的条目。
You use list_entry to get at your data object (to free it back to the kernel pool), and then use list_del to free the entry on the list.
可以使用Connectionandsessionpool面板更改池的缺省设置,这些池用于管理从特定连接工厂创建的连接和会话对象。
The Connection and session pool panels can be used to change the default settings of the pools that are used to manage the connection and session objects created from a particular connection factory.
相反,我们可以使用DataSource对象(WebSphere中定义的一种使用连接池机制的数据库连接)连接到我们的DB 2II数据库,这正是我们准备做的。
Instead, we connected to our DB2 II database using a DataSource object (a pooled database connection defined in WebSphere) and we were ready to go.
程序对堆、非堆、永久保存区(Permanent Generation),以及JVM包含的不同内存池(新生对象区、长期对象区、存活空间等)的内存使用情况
The Memory usage for the applications Heap, Non Heap, Permanent Generation and the different memory pools that the JVM has (new generation, tenured generation, survivor space, etc.)
与对象池一起使用的对象构造函数提供资源分配器的能力,无需实现完整的资源分配器。
Object constructors used in conjunction with object pooling provide the capabilities of a resource dispenser, without the effort of implementing a full resource dispenser.
与对象池一起使用的对象构造函数提供资源分配器的能力,无需实现完整的资源分配器。
Object constructors used in conjunction with object pooling provide the capabilities of a resource dispenser, without the effort of implementing a full resource dispenser.
应用推荐