コード例 #1
0
 protected void analyzeLookupResult(ChordID target, ChordID result) {
   ChordNode responder =
       ChordOverlayUtil.getResponsibleNode(
           ChordBootstrapManager.getInstance(target).getAvailableNodes(), target.getValue());
   boolean valid = responder.getOverlayID().equals(result);
   if (!valid) {
     log.error(
         "incorrect lookup result"
             + " key = "
             + target
             + " correct responder "
             + responder
             + " found = "
             + result);
   } else {
     // +1 correct lookup
     lookupCount[3]++;
   }
 }
コード例 #2
0
  public void startRandomLookup(ChordNode starter) {
    log.debug("lookup counter " + Arrays.toString(lookupCount));
    lookupCount[0]++;
    long randomLong = Simulator.getRandom().nextLong();
    String token = Long.toString(Math.abs(randomLong), 32);
    ChordID key = ChordIDFactory.getInstance().getChordID(token);
    int lookupID = starter.overlayNodeLookup(key, new MyCallback());

    log.debug("started lookup request key = " + key + " id = " + lookupID + " from = " + starter);
    lookupList.add(lookupID);
  }