create();
joinSuccess = true;
} else {
- int knownId = Integer.valueOf(args[1]);
- deadline = Integer.valueOf(args[3]);
+ int knownId = Integer.parseInt(args[1]);
+ deadline = Integer.parseInt(args[3]);
Msg.debug("Hey! Let's join the system with the id " + id + ".");
joinSuccess = join(knownId);
private void leave() {
Msg.debug("Well Guys! I Think it's time for me to quit ;)");
- quitNotify(1); //Notify my successor
- quitNotify(-1); //Notify my predecessor.
- }
-
- /**
- * @brief Notifies the successor or the predecessor of the current node of the departure
- * @param to 1 to notify the successor, -1 to notify the predecessor
- */
- static private void quitNotify( int to) {
- //TODO
+ // TODO: Notify my successor and predecessor.
}
/** @brief Initializes the current node as the first one of the system */
}
catch (MsgException e) {
commReceive = null;
- stop = true;
}
}
catch (MsgException e) {
// Performs a find successor request to a random id.
private void randomLookup() {
- int id = 1337;
- //Msg.info("Making a lookup request for id " + id);
- findSuccessor(id);
+ int dest = 1337;
+ //Msg.info("Making a lookup request for id " + dest);
+ findSuccessor(dest);
}
/**
* @param end upper bound
* @return a non-zero value if id in in [start, end]
*/
- static private boolean isInInterval(int id, int start, int end) {
+ private static boolean isInInterval(int id, int start, int end) {
int normId = normalize(id);
int normStart = normalize(start);
int normEnd = normalize(end);
* @param id an id
* @return the corresponding normalized id
*/
- static private int normalize(int id) {
+ private static int normalize(int id) {
return id & (Common.NB_KEYS - 1);
}