X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cfe9cf4207e2ca56a9cb1126a0ec27f82d46185f..2807fde4fd1f59c230d69a934634c5dfb77905f2:/examples/java/dht/kademlia/Node.java diff --git a/examples/java/dht/kademlia/Node.java b/examples/java/dht/kademlia/Node.java index 4e46ba08c2..a690a0177d 100644 --- a/examples/java/dht/kademlia/Node.java +++ b/examples/java/dht/kademlia/Node.java @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, 2016. The SimGrid Team. +/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -57,16 +57,16 @@ public class Node extends Process { } public void mainLoop() { - double next_lookup_time = Msg.getClock() + Common.RANDOM_LOOKUP_INTERVAL; + double nextLookupTime = Msg.getClock() + Common.RANDOM_LOOKUP_INTERVAL; while (Msg.getClock() < this.deadline) { try { if (comm == null) { comm = Task.irecv(Integer.toString(id)); } if (!comm.test()) { - if (Msg.getClock() >= next_lookup_time) { + if (Msg.getClock() >= nextLookupTime) { randomLookup(); - next_lookup_time += Common.RANDOM_LOOKUP_INTERVAL; + nextLookupTime += Common.RANDOM_LOOKUP_INTERVAL; } else { waitFor(1); } @@ -77,6 +77,7 @@ public class Node extends Process { } } catch (Exception e) { + Msg.debug("Caught exception: " + e); } } Msg.info(findNodeSuccedded + "/" + (findNodeSuccedded + findNodeFailed) + " FIND_NODE have succedded."); @@ -256,6 +257,7 @@ public class Node extends Process { waitFor(1); } catch (Exception ex) { + Msg.debug("Caught exception: " + ex); } } while (Msg.getClock() < timeout && !destinationFound); } @@ -275,7 +277,7 @@ public class Node extends Process { public int sendFindNodeToBest(Answer nodeList) { int destination = nodeList.getDestinationId(); int i; - for (i = 0; i < Common.alpha && i < nodeList.size(); i++) { + for (i = 0; i < Common.ALPHA && i < nodeList.size(); i++) { Contact node = nodeList.getNodes().get(i); if (node.getId() != this.id) { this.sendFindNode(node.getId(),destination);