public virtual void TestBlocking()
        {
            IQueue4 queue = new BlockingQueue();

            string[] data = new string[] { "a", "b", "c", "d" };
            queue.Add(data[0]);
            Assert.AreSame(data[0], queue.Next());
            BlockingQueueTestCase.NotifyThread notifyThread = new BlockingQueueTestCase.NotifyThread
                                                                  (queue, data[1]);
            notifyThread.Start();
            long start = Runtime.CurrentTimeMillis();

            Assert.AreSame(data[1], queue.Next());
            long end = Runtime.CurrentTimeMillis();

            Assert.IsGreater(500, end - start);
        }
Ejemplo n.º 2
0
		public virtual void TestBlocking()
		{
			IQueue4 queue = new BlockingQueue();
			string[] data = new string[] { "a", "b", "c", "d" };
			queue.Add(data[0]);
			Assert.AreSame(data[0], queue.Next());
			BlockingQueueTestCase.NotifyThread notifyThread = new BlockingQueueTestCase.NotifyThread
				(queue, data[1]);
			notifyThread.Start();
			long start = Runtime.CurrentTimeMillis();
			Assert.AreSame(data[1], queue.Next());
			long end = Runtime.CurrentTimeMillis();
			Assert.IsGreater(500, end - start);
		}