예제 #1
0
        private void ProcessCallback(IAsyncResult result)
        {
            const string method = "ProcessCallback";

            if (EventSource.IsEnabled(Event.MethodEnter))
            {
                EventSource.Raise(Event.MethodEnter, method);
            }

            // Let the channel clean up anything it needs to.

            var profileInstance = (ProfileInstance)result.AsyncState;

            try
            {
                _stepRunner.EndProcessRequest(result);

                // Run the next step.

                if (!_stopSignal.WaitOne(0))
                {
                    Run(profileInstance);
                }
            }
            catch (Exception ex)
            {
                StopIteration(profileInstance, ex);

                // Try to start off another instance for this user.

                if (!_stopSignal.WaitOne(0))
                {
                    if (ex.InnerException is StepFailedException)
                    {
                        StartIteration(((StepFailedException)ex.InnerException).User);
                    }
                }
            }

            Interlocked.Decrement(ref _outstandingRequests);

            if (EventSource.IsEnabled(Event.MethodExit))
            {
                EventSource.Raise(Event.MethodExit, method);
            }
        }
예제 #2
0
        private void ChannelCallback(IAsyncResult result)
        {
            const string method = "ChannelCallback";

            try
            {
                // We have nothing to do here, but must ensure the channel resources cleanup.

                _sink.EndProcessRequest(result);
            }
            catch (Exception e)
            {
                if (_eventSource.IsEnabled(Event.Error))
                {
                    _eventSource.Raise(Event.Error, method, "The channel has thrown an exception.", e);
                }
            }
        }