public ObjectPool(IObjectPoolPolicy <T> objectPoolPolicy) { if (objectPoolPolicy == null) { throw new ArgumentNullException("objectPoolPolicy"); } _objectPoolPolicy = objectPoolPolicy; }
/// <summary> /// Initializes a new instance of the <see cref="ObjectPool{T}"/> class. /// </summary> /// <param name="policy">The object pool policy.</param> /// <param name="maxItems">Number of items to keep, defaults to number of processors * 2.</param> public ObjectPool(IObjectPoolPolicy <T> policy, int?maxItems = null) { if (maxItems == null || maxItems <= 0) { maxItems = Environment.ProcessorCount * 2; } _policy = policy ?? throw new ArgumentNullException(nameof(policy)); _items = new T[maxItems.Value]; }
public SimpleRpcClientPool(IObjectPoolPolicy <SimpleRpcClient> objectPoolPolicy) : base(objectPoolPolicy) { }