示例#1
0
 protected AbstractKeyedPool(string instanceName, IKeyedPooledItemFactory <TItem, TKey> factory, EvictionCriteria evictionCriteria)
 {
     this.instanceName     = instanceName;
     this.factory          = factory;
     this.evictionCriteria = evictionCriteria;
     // setup eviction timer
     evictionTimer          = new Timer();
     evictionTimer.Interval = evictionCriteria.Interval.TotalMilliseconds;
     evictionTimer.Elapsed += EvictIdleItems;
     evictionTimer.Enabled  = true;
     // item leak timer
     leakTimer          = new Timer();
     leakTimer.Interval = 1000;
     leakTimer.Elapsed += ProcessLeakedItems;
     leakTimer.Enabled  = true;
 }
示例#2
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();
 }
 public UnboundedKeyedPool(string instanceName, IKeyedPooledItemFactory <TItem, TKey> factory, EvictionCriteria evictionCriteria)
     : base(instanceName, factory, evictionCriteria)
 {
 }
示例#4
0
        public BoundedKeyedPool(string instanceName, IKeyedPooledItemFactory <TItem, TKey> factory, Bounds bounds, EvictionCriteria evictionCriteria)
            : base(instanceName, factory, evictionCriteria)
        {
            this.bounds = bounds;

            DeadItem += OnDeadItem;
        }
示例#5
0
        public UnboundedPool(string instanceName, IPooledItemFactory <TItem> factory, Bounds bounds, EvictionCriteria criteria)
            : base(instanceName, factory, new LinkedQueue <TimeRecord <TItem> >(), criteria)
        {
            this.bounds = bounds;

            PreFill();
        }
示例#6
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;
        }