예제 #1
0
		public virtual void TestTimeoutNext()
		{
			BlockingQueue queue = new BlockingQueue();
			Assert.IsNull(AssertTakeAtLeast(200, new _IClosure4_35(queue)));
			object obj = new object();
			queue.Add(obj);
			Assert.AreSame(obj, AssertTakeLessThan(50, new _IClosure4_46(queue)));
			Assert.IsNull(AssertTakeAtLeast(200, new _IClosure4_53(queue)));
		}
예제 #2
0
 internal ClientMessageDispatcherImpl(ClientObjectContainer client, Socket4Adapter
     a_socket, BlockingQueue synchronousMessageQueue, BlockingQueue asynchronousMessageQueue
     )
 {
     _container = client;
     _synchronousMessageQueue = synchronousMessageQueue;
     _asynchronousMessageQueue = asynchronousMessageQueue;
     _socket = a_socket;
 }
예제 #3
0
 public virtual void TestDrainTo()
 {
     var queue = new BlockingQueue();
     queue.Add(new object());
     queue.Add(new object());
     var list = new Collection4();
     Assert.AreEqual(2, queue.DrainTo(list));
     Assert.AreEqual(2, list.Size());
     Assert.IsFalse(queue.HasNext());
 }
예제 #4
0
		public virtual void TestNext()
		{
			IQueue4 queue = new BlockingQueue();
			string[] data = new string[] { "a", "b", "c", "d" };
			queue.Add(data[0]);
			Assert.AreSame(data[0], queue.Next());
			queue.Add(data[1]);
			queue.Add(data[2]);
			Assert.AreSame(data[1], queue.Next());
			Assert.AreSame(data[2], queue.Next());
		}
		/// <exception cref="System.Exception"></exception>
		public virtual void TestIsAliveInMultiThread()
		{
			IBlockingQueue4 barrier = new BlockingQueue();
			client = (ClientObjectContainer)OpenNewSession();
			client.MessageListener(new _IMessageListener_23(this, barrier));
			Thread workThread = new Thread(new _IRunnable_38(), "Quering");
			workThread.SetDaemon(true);
			workThread.Start();
			barrier.Next();
			client.IsAlive();
		}
예제 #6
0
		public virtual void TestIterator()
		{
			IQueue4 queue = new BlockingQueue();
			string[] data = new string[] { "a", "b", "c", "d" };
			for (int idx = 0; idx < data.Length; idx++)
			{
				AssertIterator(queue, data, idx);
				queue.Add(data[idx]);
				AssertIterator(queue, data, idx + 1);
			}
		}
예제 #7
0
		public CommittedCallbacksDispatcher(ObjectServerImpl server, BlockingQueue committedInfosQueue
			)
		{
			_server = server;
			_committedInfosQueue = committedInfosQueue;
		}
예제 #8
0
 public _IClosure4_46(BlockingQueue _enclosing, long timeout)
 {
     this._enclosing = _enclosing;
     this.timeout    = timeout;
 }
예제 #9
0
 public _IClosure4_38(BlockingQueue _enclosing)
 {
     this._enclosing = _enclosing;
 }
예제 #10
0
 public _IClosure4_20(BlockingQueue _enclosing, object obj)
 {
     this._enclosing = _enclosing;
     this.obj        = obj;
 }
예제 #11
0
 public _IClosure4_95(BlockingQueue _enclosing, IPredicate4 condition)
 {
     this._enclosing = _enclosing;
     this.condition  = condition;
 }
예제 #12
0
 public _IClosure4_54(BlockingQueue _enclosing, Collection4 target)
 {
     this._enclosing = _enclosing;
     this.target     = target;
 }
		public ClientAsynchronousMessageProcessor(BlockingQueue messageQueue)
		{
			_messageQueue = messageQueue;
		}
예제 #14
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);
		}
예제 #15
0
			public _IClosure4_53(BlockingQueue queue)
			{
				this.queue = queue;
			}
예제 #16
0
		public virtual void TestStop()
		{
			BlockingQueue queue = new BlockingQueue();
			string[] data = new string[] { "a", "b", "c", "d" };
			queue.Add(data[0]);
			Assert.AreSame(data[0], queue.Next());
			BlockingQueueTestCase.StopThread notifyThread = new BlockingQueueTestCase.StopThread
				(queue);
			notifyThread.Start();
			Assert.Expect(typeof(BlockingQueueStoppedException), new _ICodeBlock_110(queue));
		}
예제 #17
0
			internal StopThread(BlockingQueue queue)
			{
				_queue = queue;
			}
예제 #18
0
			public _ICodeBlock_110(BlockingQueue queue)
			{
				this.queue = queue;
			}