Ejemplo n.º 1
0
        private ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>> readMsgSeqMap(HermesPrimitiveCodec codec)
        {
            ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>> msgSeqMap = new ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>>();

            int mapSize = codec.ReadInt();
            if (mapSize != 0)
            {
                List<Triple<Tpp, string, bool>> tppgrs = new List<Triple<Tpp, string, bool>>();
                for (int i = 0; i < mapSize; i++)
                {
                    Tpp tpp = new Tpp(codec.ReadString(), codec.ReadInt(), codec.ReadInt() == 0 ? true : false);
                    String groupId = codec.ReadString();
                    bool resend = codec.ReadBoolean();
                    tppgrs.Add(new Triple<Tpp, string, bool>(tpp, groupId, resend));
                }
                for (int i = 0; i < mapSize; i++)
                {
                    Triple<Tpp, string, bool> tppgr = tppgrs[i];

                    int len = codec.ReadInt();
                    if (len == 0)
                    {
                        msgSeqMap[tppgr] = new List<AckContext>();
                    }
                    else
                    {
                        msgSeqMap[tppgr] = new List<AckContext>(len);
                    }

                    for (int j = 0; j < len; j++)
                    {
                        msgSeqMap[tppgr].Add(new AckContext(codec.ReadLong(), codec.ReadInt(), codec.ReadLong(), codec.ReadLong()));
                    }
                }
            }

            return msgSeqMap;
        }
Ejemplo n.º 2
0
 public void addNackMsg(Tpp tpp, String groupId, bool resend, long msgSeq, int remainingRetries,
                        long onMessageStartTimeMillis, long onMessageEndTimeMillis)
 {
     Triple<Tpp, string, bool> key = new Triple<Tpp, string, bool>(tpp, groupId, resend);
     if (!m_nackMsgSeqs.ContainsKey(key))
     {
         m_nackMsgSeqs.TryAdd(key, new List<AckContext>());
     }
     m_nackMsgSeqs[key].Add(
         new AckContext(msgSeq, remainingRetries, onMessageStartTimeMillis, onMessageEndTimeMillis));
 }