Exemplo n.º 1
0
        public virtual void Init(PoolSettings settings)
        {
            Settings = settings ?? new PoolSettings();

            for (var i = 0; i < Settings.PreloadCount; i++)
            {
                Extend();
            }
        }
Exemplo n.º 2
0
        public TPool CreatePool <TContent, TPool>(string id, PoolSettings settings)
            where TContent : class
            where TPool : AbstractPool <TContent>, new()
        {
            if (_pools.ContainsKey(id))
            {
                throw new Exception($"Pool with id {id} already registered");
            }

            TPool pool = null;

            try
            {
                pool = new TPool();
                pool.Init(settings);
                _pools.Add(id, pool);
                return(pool);
            }
            catch (Exception exception)
            {
                throw;
            }
        }