Beispiel #1
0
        static void Main(string[] args)
        {
            ItemStore itemStore = new ItemStore();
            Customer  testCust  = new Customer("Jerry");

            itemStore.Store(testCust);
            string nameString = Console.ReadLine();

            while (nameString != _quitString)
            {
                testCust = new Customer(nameString);
                itemStore.Store(testCust);
                nameString = Console.ReadLine();
            }
        }
Beispiel #2
0
 private void Preload(int preloadCount)
 {
     for (int i = 0; i < preloadCount; i++)
     {
         ItemStore.Store(factory());
     }
 }
Beispiel #3
0
        /// <summary>
        ///     Release a pooled item back to the store
        /// </summary>
        /// <param name="item"></param>
        public void Release(T item)
        {
            lock (ItemStore) {
                ItemStore.Store(item);
            }

            _sync.Release();
        }
Beispiel #4
0
 /// <summary>
 ///     Preloads all items
 /// </summary>
 protected void PreloadItems()
 {
     for (var i = 0; i < PoolSize; i++)
     {
         var item = ItemFactoryFunc(this);
         ItemStore.Store(item);
     }
 }
Beispiel #5
0
 public override void PutItem(T item)
 {
     ItemStore.Store(item);
 }