Provides a pool implementation for
Instances.
Namespace:
WebSupergoo.TaskGarden
Syntax
| C# |
|---|
public sealed class Pool<TInterface> : IDisposable where TInterface : class |
| Visual Basic |
|---|
Public NotInheritable Class Pool( Of TInterface As Class) _ Implements IDisposable |
Type Parameters
- TInterface
- A user-defined interface which can be used to control the target of an Instance.
Remarks
This class provides a pool implementation to manage a number of Instance objects of the same target class. Any method called on the Target interface may be executed by any of the pooled instances.
One typical usage is to host a group of Instances that require non-trivial initialization/cleanup. They can be re-used through the pool. Any failure or crashes can be recovered easily by using the AutoRetryCount property.
Note that the Pool class is provided mainly as a convenient utility. There are cases where using a pool to manage Instances is not appropriate. For example, if you are creating a multi-process Web browser, you may need to distinguish each tab as an Instance, so you may be better of putting the instances in a List.