Beispiel #1
0
 /** Stops the execution of the thread. */
 public void stop() {
   basic.Logger.append("Killing this node...");
   this.killNode();
   basic.Logger.append("..");
   if (!basic.Global.SIMPLE) {
     basic.Logger.inf(
         "find_successor has been called " + basic.HopsAndTime.search_counter + " times");
     basic.Logger.inf("Average hops/find_successor: " + basic.HopsAndTime.getAvgHops());
     basic.Logger.inf("Average execution time/find_successor: " + basic.HopsAndTime.getAvgTime());
   }
   basic.Logger.append("..");
   receivemulticast.stop();
   basic.Logger.append(".");
   MulticastSender fixmulticast;
   if (!basic.Global.SIMPLE) {
     try {
       fixmulticast =
           new networking.MulticastSender(
               1101, "224.1.1.1", ("fix " + node.getPid()).getBytes(), node);
       fixmulticast.start();
       basic.Logger.append(".");
       try {
         fixmulticast.getThread().join();
       } catch (InterruptedException ex) {
         Logger.getLogger(DJchord.class.getName()).log(Level.SEVERE, null, ex);
       }
     } catch (RemoteException ex) {
       Logger.getLogger(DJchord.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   basic.Logger.append(".");
   runner.interrupt();
   runner = null;
   basic.Logger.appendln("done!");
 }