public void Execute()
        {
            if (!_earlier._isCompleted)
            {
                lock (this)
                {
                    if (!_earlier._isCompleted)
                    {
                        Monitor.Wait(this, (int)_msecTimeout);
                    }
                }
            }

            _view.Execute();
            _isCompleted = true;

            if (_later != null)
            {
                lock (_later)
                {
                    Monitor.Pulse(_later);
                }
            }
            _earlier = null;
            _later   = null;
        }
Example #2
0
        public override void NewResult(UniformPair <EventBean[]> results)
        {
            StatementResultService.Indicate(results);

            if (!IsDispatchWaiting.Value)
            {
                UpdateDispatchFutureWait nextFutureWait;
                lock (this)
                {
                    nextFutureWait = new UpdateDispatchFutureWait(this, _currentFutureWait, _msecTimeout);
                    _currentFutureWait.SetLater(nextFutureWait);
                    _currentFutureWait = nextFutureWait;
                }
                DispatchService.AddExternal(nextFutureWait);
                IsDispatchWaiting.Value = true;
            }
        }
Example #3
0
 /// <summary>Ctor. </summary>
 /// <param name="dispatchService">for performing the dispatch</param>
 /// <param name="msecTimeout">timeout for preserving dispatch order through blocking</param>
 /// <param name="statementResultServiceImpl">handles result delivery</param>
 public UpdateDispatchViewBlockingWait(StatementResultService statementResultServiceImpl, DispatchService dispatchService, long msecTimeout)
     : base(statementResultServiceImpl, dispatchService)
 {
     _currentFutureWait = new UpdateDispatchFutureWait(); // use a completed future as a start
     _msecTimeout       = msecTimeout;
 }
 /// <summary>Hand a later future to the dispatch to use for indicating completion via notify. </summary>
 /// <param name="later">is the later dispatch</param>
 public void SetLater(UpdateDispatchFutureWait later)
 {
     _later = later;
 }
 /// <summary>Ctor. </summary>
 /// <param name="view">is the blocking dispatch view through which to execute a dispatch</param>
 /// <param name="earlier">is the older future</param>
 /// <param name="msecTimeout">is the timeout period to wait for listeners to complete a prior dispatch</param>
 public UpdateDispatchFutureWait(UpdateDispatchViewBlockingWait view, UpdateDispatchFutureWait earlier, long msecTimeout)
 {
     _view        = view;
     _earlier     = earlier;
     _msecTimeout = msecTimeout;
 }