Пример #1
0
        public void TestDataBufferPool()
        {
            try
            {
                DateTime d = default(DateTime);

                DateTime d1 = JinRiDBFacade.Instance.GetDateTimeNow();
            }
            catch
            {
            }
            int             count = 0;
            IDataBufferPool pool  = new DataBufferPool((x) =>
            {
                List <object> arr = ((DataBuffer)x).GetList <object>();
                Interlocked.Add(ref count, arr.Count);
                Debug.WriteLine(count);
            }, false);

            for (int i = 0; i < 1000000; i++)
            {
                pool.Write(i);
                //if (i % 100 == 0)
                //System.out.println(i);
            }

            pool.Flush();
            Thread.Sleep(15000);
            Assert.Equals(1000000, count);
        }
Пример #2
0
 /// <summary>
 /// 写数据
 /// </summary>
 /// <param name="pool"></param>
 /// <param name="count"></param>
 private void Write(DataBufferPool pool, int count)
 {
     for (int i = 0; i < count; i++)
     {
         pool.Write(new DataObj {
             Index = i, Des = "测试" + i, CreateTime = DateTime.Now
         });
     }
 }