Ejemplo n.º 1
0
 public void Register(string entryURL)
 {
     //check if other nodes exist
     Logger.LogInfo("starting network registration on node: " + entryURL);
     if (entryURL != null)
     {
         IWorker       worker = (IWorker)Activator.GetObject(typeof(IWorker), entryURL);
         List <String> urls   = worker.AddWorker(myURL, true);
         nextURL     = urls[1];
         nextNextURL = urls[2];
         backURL     = urls[3];
         if (urls[0].Equals("smallUpdate"))
         {
             Logger.LogInfo("Updating existing node at: " + nextURL);
             worker = (IWorker)Activator.GetObject(typeof(IWorker), nextURL);
             worker.AddWorker(myURL, false);
         }
         if (urls[0].Equals("bigUpdate"))
         {
             string wayBackURL = urls[4];
             Logger.LogInfo("Updating back node at: " + wayBackURL);
             worker = (IWorker)Activator.GetObject(typeof(IWorker), wayBackURL);
             worker.BackUpdate(myURL);
             Logger.LogInfo("Updating next node at: " + nextURL);
             worker = (IWorker)Activator.GetObject(typeof(IWorker), nextURL);
             worker.FrontUpdate(myURL);
         }
         PrintUpdateNetwork();
     }
     else
     {
         Logger.LogErr("Did not provided entryURL");
     }
 }