예제 #1
0
        public Serialize(int numberOfThreads, Func <IMessage, string> getQueueNameFromMessage)
        {
            _messages = new NotifyingMultiQueue <ScheduledTask>();
            _getQueueNameFromMessage = getQueueNameFromMessage;

            _waitForWork = new List <Wait_for_work <ScheduledTask> >();
            for (var i = 0; i < numberOfThreads; i++)
            {
                var wfw = new Wait_for_work <ScheduledTask>(_messages,
                                                            () =>
                {
                    ScheduledTask result;
                    var success = _messages.TryDequeue(Thread.CurrentThread.GetHashCode().ToString(),
                                                       out result);
                    return(new Tuple <bool, ScheduledTask>(success, result));
                });
                wfw.Dequeued += _ => _.ContinueWith(_.Message);
                _waitForWork.Add(wfw);
            }
        }
예제 #2
0
        public Serialize(int numberOfThreads, Func<IMessage,string> getQueueNameFromMessage)
        {
            _messages = new NotifyingMultiQueue<ScheduledTask>();
            _getQueueNameFromMessage = getQueueNameFromMessage;

            _waitForWork = new List<Wait_for_work<ScheduledTask>>();
            for (var i = 0; i < numberOfThreads; i++)
            {
                var wfw = new Wait_for_work<ScheduledTask>(_messages,
                                               () =>
                                               {
                                                   ScheduledTask result;
                                                   var success = _messages.TryDequeue(Thread.CurrentThread.GetHashCode().ToString(),
                                                                                      out result);
                                                   return new Tuple<bool, ScheduledTask>(success, result);
                                               });
                wfw.Dequeued += _ => _.ContinueWith(_.Message);
                _waitForWork.Add(wfw);
            }
        }
예제 #3
0
 public void Before_each_test()
 {
     _sut    = new NotifyingMultiQueue <string>();
     _result = null;
 }
 public void Before_each_test()
 {
     _sut = new NotifyingMultiQueue<string>();
     _result = null;
 }