public void setup()
        {
            int hours = 0;
            int minutes = 0;
            int seconds = 1;

            archive = new MessageArchive(hours,minutes,seconds);
            testMsg = new StubMsgCommand();
            testMsg.guid = "TESTGUIDBECAUSSEITSASTRING";
        }
Example #2
0
        public Boolean TryPostMessage(MsgCommand mc)
        {
            rwl.EnterWriteLock();
            try
            {

                //TODO check to see that the guid is not in use and if it is send a message back to the sender
                if (archive.Contains(mc.guid))
                {
                    return false;
                }

                var timeCanDie = DateTime.Now + timeToLive;
                archive.Add(mc.guid, mc, timeCanDie);

            }
            finally
            {
                // Ensure that the lock is released.
                rwl.ExitWriteLock();
            }
            return true;
        }
Example #3
0
 public ArchiveCommand(MsgCommand toArchive)
 {
     ToArchive = toArchive;
 }