Пример #1
0
        private InputQueueChannelListener <TInnerChannel> MatchListener(Message message)
        {
            InputQueueChannelListener <TInnerChannel> data = null;

            lock (this.ThisLock)
            {
                if (this.filterTable.GetMatchingValue(message, out data))
                {
                    return(data);
                }
            }
            return(null);
        }
Пример #2
0
        protected void HandleUnknownException(Exception exception)
        {
            InputQueueChannelListener <TInnerChannel> listener = null;

            lock (this.ThisLock)
            {
                if (this.filterTable.Count > 0)
                {
                    KeyValuePair <MessageFilter, InputQueueChannelListener <TInnerChannel> >[] array = new KeyValuePair <MessageFilter, InputQueueChannelListener <TInnerChannel> > [this.filterTable.Count];
                    this.filterTable.CopyTo(array, 0);
                    listener = array[0].Value;
                    if (this.onItemDequeued == null)
                    {
                        this.onItemDequeued = new Action(this.OnItemDequeued);
                    }
                    listener.InputQueueAcceptor.EnqueueAndDispatch(exception, this.onItemDequeued, false);
                }
            }
        }
Пример #3
0
        private void ProcessItem(TInnerChannel channel, TInnerItem item)
        {
            InputQueueChannelListener <TInnerChannel> channelManager = null;
            TInnerChannel local = default(TInnerChannel);
            bool          flag  = true;

            try
            {
                Message message = this.GetMessage(item);
                try
                {
                    channelManager = this.MatchListener(message);
                    flag           = channelManager == null;
                }
                catch (CommunicationException exception)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
                    }
                    return;
                }
                catch (MultipleFilterMatchesException exception2)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
                    }
                    return;
                }
                catch (XmlException exception3)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
                    }
                    return;
                }
                finally
                {
                    if (flag)
                    {
                        this.throttle.Release();
                    }
                }
                if (channelManager == null)
                {
                    try
                    {
                        throw TraceUtility.ThrowHelperError(new EndpointNotFoundException(System.ServiceModel.SR.GetString("UnableToDemuxChannel", new object[] { message.Headers.Action })), message);
                    }
                    catch (EndpointNotFoundException exception4)
                    {
                        if (DiagnosticUtility.ShouldTraceInformation)
                        {
                            DiagnosticUtility.ExceptionUtility.TraceHandledException(exception4, TraceEventType.Information);
                        }
                        this.EndpointNotFound(channel, item);
                        channel = default(TInnerChannel);
                        item    = default(TInnerItem);
                    }
                    return;
                }
                local   = this.CreateChannel(channelManager, channel, item);
                channel = default(TInnerChannel);
                item    = default(TInnerItem);
            }
            finally
            {
                if (item != null)
                {
                    this.AbortItem(item);
                }
                if (channel != null)
                {
                    channel.Abort();
                }
            }
            bool flag2 = false;

            try
            {
                if (this.onItemDequeued == null)
                {
                    this.onItemDequeued = new Action(this.OnItemDequeued);
                }
                channelManager.InputQueueAcceptor.EnqueueAndDispatch(local, this.onItemDequeued, false);
                flag2 = true;
            }
            catch (Exception exception5)
            {
                if (Fx.IsFatal(exception5))
                {
                    throw;
                }
                this.HandleUnknownException(exception5);
            }
            finally
            {
                if (!flag2)
                {
                    this.throttle.Release();
                    local.Abort();
                }
            }
        }