예제 #1
0
 public Pool(int startSize, IBurstStrategy burstStrategy, IPooledItemFactory <T> fillStrategy)
 {
     _burstStrategy = burstStrategy;
     Count          = startSize;
     _fillStrategy  = fillStrategy;
     Initialize();
 }
예제 #2
0
        public UnboundedPool(string instanceName, IPooledItemFactory <TItem> factory, Bounds bounds, EvictionCriteria criteria)
            : base(instanceName, factory, new LinkedQueue <TimeRecord <TItem> >(), criteria)
        {
            this.bounds = bounds;

            PreFill();
        }
예제 #3
0
        public BoundedPool(string instanceName, IPooledItemFactory <TItem> factory, Bounds bounds, EvictionCriteria criteria)
            : base(instanceName, factory, new BoundedLinkedQueue <TimeRecord <TItem> >(bounds.MaxCount), criteria)
        {
            this.bounds = bounds;

            PreFill();

            DeadItem += OnDeadItem;
        }
예제 #4
0
 protected AbstractPool(string instanceName, IPooledItemFactory <TItem> factory, Threading.IQueue <TimeRecord <TItem> > pool, EvictionCriteria evictionCriteria)
 {
     this.instanceName     = instanceName;
     this.factory          = factory;
     this.pool             = pool;
     this.evictionCriteria = evictionCriteria;
     // setup eviction timer
     evictionTimer          = new Timer();
     evictionTimer.Interval = evictionCriteria.Interval.TotalMilliseconds;
     evictionTimer.Elapsed += EvictIdleItems;
     evictionTimer.Start();
     // item leak timer
     leakTimer          = new Timer();
     leakTimer.Interval = 1000;
     leakTimer.Elapsed += ProcessLeakedItems;
     leakTimer.Start();
 }
예제 #5
0
 private void PrepareInterfaces()
 {
     _burstStrategy = new BurstStrategy();
     _fillStrategy  = new FillStrategy();
 }
예제 #6
0
 public Pool(int startSize, IPooledItemFactory <T> fillStrategy)
 {
     _fillStrategy = fillStrategy;
     Count         = startSize;
     Initialize();
 }