Beispiel #1
0
        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();
        }
Beispiel #2
0
 public static IObjectPool <T> NewObjectPool <T>(IObjectPoolConfig <T> config)
 {
     return(new ObjectPool <T>(config));
 }