Pooled Class Factory
The Pooled Class Factory maintains a list of instances of services available to serve requests. Rather than creating a separate instance for each call or always using the same instance, it creates a predefined number of instances and returns the first one currently available to the caller.
Options are provided to control the size of the pool and the behavior in case all pooled instances are active.
Use Cases
The Pooled Class Factory is the most commonly used factory for high performance and high load services. It avoids the cost of repeatedly creating/destroying service instances (as with the Standard Class Factory) while at the same eliminating the overhead of keeping an instance per client (as with the Per-Client Class Factory).
It is worth mentioning that with this class factory (as with the Singleton Class Factory), instances will be shared between different clients, so care must be taken that the service is designed with statelessness in mind, and no client-specific data is stored in class fields between calls. Refer to Session Management for alternative ways to persist per-client information between calls.
Class Factory Types
- PooledClassFactory (.NET)
- TROPooledClassFactory (Delphi)