Esempio n. 1
0
 public ConcurrentClientsSimulator() : base()
 {
     Console.Out.WriteLine("\n[ClientSimulator] Concurrent simulator is going to start with {0}", settings.experimentNumberOfClients);
     clients = new ConcurrentClient[settings.experimentNumberOfClients];
     // 👇
     configure();
     for (int i = 0; i < settings.experimentNumberOfClients; i++)
     {
         clients[i] = new ConcurrentClient(i + 1, settings); // id>0 means this is not a terminating client
     }
     // 👆
 }
Esempio n. 2
0
        public void ConcurrentSimulation()
        {
            try
            {
                // todo [Assignment]: implement required code
                for (int i = 0; i < clients.Length; i++)
                {
                    clients[i] = new ConcurrentClient(i, settings);
                }

                for (int i = 0; i < clients.Length; i++)
                {
                    clients[i].workerThread.Join();
                }
            }
            catch (Exception e)
            { Console.Out.WriteLine("[Concurrent Simulator] {0}", e.Message); }
        }