Пример #1
0
        public Boolean AddNewMessage(string publisherId, int messageSequenceNumber)
        {
            lock (this)
            {
                if (detectRepeatedMessages.IsRepeated(messageSequenceNumber, publisherId))
                {
                    return(true);
                }
                if (!messages.ContainsKey(publisherId))
                {
                    messages.Add(publisherId, new Queue <int>());
                }

                lock (messages[publisherId])
                {
                    messages[publisherId].Enqueue(messageSequenceNumber);
                }
            }
            return(false);
        }
        public void Bludger(Bludger bludger)
        {
            this.BlockWhileFrozen();
            lock (this)
            {
                if (blu.IsRepeated(bludger.Sequence, bludger.Publisher))
                {
                    return;
                }

                foreach (var e in freezer)
                {
                    if (e.SequenceNumber == bludger.Sequence && e.Publisher == bludger.Publisher)
                    {
                        Console.WriteLine("Publisher: {0} Topic: {1} SN: {2}", e.Publisher, e.Topic, e.GetSequenceNumber());
                        logServer.LogAction("SubEvent " + name + " " + e.Publisher + " " + e.Topic + " " + e.SequenceNumber);
                        return;
                    }
                }
            }
        }