The Spring.Pool namespace contains a generic API for implementing pools of objects. Object pooling is a well known technique to minimize the creation of objects that can take a significant amount of time. Common examples are to create a pool of database connections such that each request to the database can reuse an existing connection instead of creating one per client request. Threads are also another common candidate for pooling in order to increase responsiveness of an application to multiple concurrent client requests.
.NET contains support for object pooling in these common scenarios. Support for database connection pools is directly supported by ADO.NET data providers as a configuration option. Similarly, thread pooling is supported via the System.ThreadPool class. Support for pooling of other objects can be done using the CLR managed API to COM+ found in the System.EnterpriseServices namespace.
Despite this built-in support there are scenarios where you would
like to use alternative pool implementations. This may be because the
default implementations, such as System.ThreadPool, do not meet your
requirements. (For a discussion on advanced ThreadPool usage see Smart Thread
Pool by Ami Bar.) Alternatively, you may want to pool classes that
do not inherit from
Note, that if you are concerned only with applying pooling to an
existing object, the pooling APIs discussed here are not very important.
Instead the use and configuration of
Chapter 37, IoC Quickstarts contains an example that shows the use of the pooling API independent of AOP functionality.