public ObjectPool(IObjectPoolConfig <T> config) { if (config == null) { throw new ArgumentNullException("config is null"); } Config = config; AddLock = new object(); _keyGenerator = NewKeyGenerator(); _availableKeys = new BlockingCollection <object>(new ConcurrentStack <object>()); _entries = new ConcurrentDictionary <object, IEntry <T> >(); Init(); }
public static IObjectPool <T> NewObjectPool <T>(IObjectPoolConfig <T> config) { return(new ObjectPool <T>(config)); }