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; }
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) { }
public BoundedKeyedPool(string instanceName, IKeyedPooledItemFactory <TItem, TKey> factory, Bounds bounds, EvictionCriteria evictionCriteria) : base(instanceName, factory, evictionCriteria) { this.bounds = bounds; DeadItem += OnDeadItem; }
public UnboundedPool(string instanceName, IPooledItemFactory <TItem> factory, Bounds bounds, EvictionCriteria criteria) : base(instanceName, factory, new LinkedQueue <TimeRecord <TItem> >(), criteria) { this.bounds = bounds; PreFill(); }
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; }