Example #1
0
 void ReleaseProcessor(EndpointAddressProcessor context)
 {
     lock (processorPool)
     {
         context.Next         = processorPool.Target as EndpointAddressProcessor;
         processorPool.Target = context;
     }
 }
Example #2
0
            internal EndpointAddressProcessor Pop()
            {
                EndpointAddressProcessor p = _processor;

                if (null != p)
                {
                    _processor = p.Next;
                    p.Next     = null;
                    return(p);
                }
                return(null);
            }
            internal EndpointAddressProcessor Pop()
            {
                EndpointAddressProcessor p = processor;

                if (null != p)
                {
                    processor = (EndpointAddressProcessor)p.next;
                    p.next    = null;
                    return(p);
                }
                return(null);
            }
 void ReleaseProcessor(EndpointAddressProcessor processor)
 {
     lock (processorPool)
     {
         ProcessorPool pool = processorPool.Target as ProcessorPool;
         if (null == pool)
         {
             pool = new ProcessorPool();
             processorPool.Target = pool;
         }
         pool.Push(processor);
     }
 }
        Candidate GetSingleMatch(CandidateSet cset, Message message)
        {
            int candiCount = cset.candidates.Count;

            if (cset.qnames.Count == 0)
            {
                if (candiCount == 0)
                {
                    return(null);
                }
                else if (candiCount == 1)
                {
                    return(cset.candidates[0]);
                }
                else
                {
                    Collection <MessageFilter> matches = new Collection <MessageFilter>();
                    for (int i = 0; i < candiCount; ++i)
                    {
                        matches.Add(cset.candidates[i].filter);
                    }
                    throw TraceUtility.ThrowHelperError(new MultipleFilterMatchesException(SR.FilterMultipleMatches, null, matches), message);
                }
            }

            EndpointAddressProcessor context = CreateProcessor(size);

            context.ProcessHeaders(message, cset.qnames, headerLookup);

            Candidate        can    = null;
            List <Candidate> candis = cset.candidates;

            for (int i = 0; i < candiCount; ++i)
            {
                if (context.TestMask(candis[i].mask))
                {
                    if (can != null)
                    {
                        Collection <MessageFilter> matches = new Collection <MessageFilter>();
                        matches.Add(can.filter);
                        matches.Add(candis[i].filter);
                        throw TraceUtility.ThrowHelperError(new MultipleFilterMatchesException(SR.FilterMultipleMatches, null, matches), message);
                    }
                    can = candis[i];
                }
            }

            ReleaseProcessor(context);

            return(can);
        }
Example #6
0
        internal bool Match(Message message)
        {
            if (size == 0)
            {
                return(true);
            }

            EndpointAddressProcessor context = CreateProcessor(size);

            context.ProcessHeaders(message, qnameLookup, headerLookup);
            bool result = context.TestExact(mask);

            ReleaseProcessor(context);
            return(result);
        }
        void InnerMatchFilters(Message message, ICollection <MessageFilter> results, CandidateSet cset)
        {
            EndpointAddressProcessor context = CreateProcessor(size);

            context.ProcessHeaders(message, cset.qnames, headerLookup);

            List <Candidate> candis = cset.candidates;

            for (int i = 0; i < candis.Count; ++i)
            {
                if (context.TestMask(candis[i].mask))
                {
                    results.Add(candis[i].filter);
                }
            }

            ReleaseProcessor(context);
        }
Example #8
0
        EndpointAddressProcessor CreateProcessor(int length)
        {
            if (processorPool.Target != null)
            {
                lock (processorPool)
                {
                    object o = processorPool.Target;
                    if (o != null)
                    {
                        EndpointAddressProcessor p = (EndpointAddressProcessor)o;
                        processorPool.Target = p.Next;
                        p.Next = null;
                        p.Clear(length);
                        return(p);
                    }
                }
            }

            return(new EndpointAddressProcessor(length));
        }
        EndpointAddressProcessor CreateProcessor(int length)
        {
            EndpointAddressProcessor p = null;

            lock (processorPool)
            {
                ProcessorPool pool = processorPool.Target as ProcessorPool;
                if (null != pool)
                {
                    p = pool.Pop();
                }
            }

            if (null != p)
            {
                p.Clear(length);
                return(p);
            }

            return(new EndpointAddressProcessor(length));
        }
Example #10
0
 internal void Push(EndpointAddressProcessor p)
 {
     p.Next     = _processor;
     _processor = p;
 }
 internal void Push(EndpointAddressProcessor p)
 {
     p.next    = processor;
     processor = p;
 }